Skip to content

Commit

Permalink
update project module version
Browse files Browse the repository at this point in the history
  • Loading branch information
digicosmos86 committed Jul 19, 2024
1 parent 23d96ac commit 5d9d6b6
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 35 deletions.
102 changes: 102 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 8 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,13 @@ We recommend using [asdf](https://asdf-vm.com) to manage your versions of Terraf
brew install asdf
```

Alternatively you can use [tfenv](https://github.com/tfutils/tfenv) and [rbenv](https://github.com/rbenv/rbenv)
### Terraform

### Terraform and Ruby

The tests can simply run in CI. If you want to run the tests locally, you will need to install the version of terraform and Ruby specified in the `.tool-versions` file (or `.terraform-version`, `.ruby-version`).
You can also install the latest version of terraform version via brew.

```
asdf plugin-add terraform https://github.com/asdf-community/asdf-hashicorp.git
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
```

#### Pre-commit hooks
Expand Down Expand Up @@ -144,34 +141,14 @@ to set and uset the `GOOGLE_APPLICATION_CREDENTIALS` variable.

### Testing

This repository uses Kitchen-Terraform to test the terraform modules. In the [examples](/examples) directory you can find examples of how each module can be used. Those examples are fed to [Test Kitchen][https://kitchen.ci/]. To install test kitchen, first make sure you have Ruby and bundler installed.

```
gem install bundler
```

Then install the prerequisites for test kitchen.

```
bundle install
```

You'll need to add some common credentials and secret variables

And now you're ready to run test kitchen. Test kitchen has a couple main commands:

- `bundle exec kitchen create` initializes terraform.
- `bundle exec kitchen converge` runs our terraform examples.
- `bundle exec kitchen verify` runs our inspec scripts against a converged kitchen.
- `bundle exec kitchen destroy` destroys infrastructure.
- `bundle exec kitchen test` does all the above.
The tests can be run locally with `terraform test` after running `terraform init`. You will need to supply `org_id`, `folder_id`, and `billing_account` variables through `terraform.tfvars` file. Please see `terraform.tfvars.example` file for an example.


### CI
This project has three workflows enabled:

1. PR labeler: When openning a PR to defaukt branch, a label is given assigned automatically accourding to the name of your feature branch. The labeler follows the follows rules in [pr-labeler.yml](.github/pr-labeler.yml)
1. PR labeler: When opening a PR to default branch, a label is given assigned automatically according to the name of your feature branch. The labeler follows the follows rules in [pr-labeler.yml](.github/pr-labeler.yml)

2. Realease Drafter: When merging to main, a release is drafted using the [Release-Drafter Action](https://github.com/marketplace/actions/release-drafter)
2. Release Drafter: When merging to master, a release is drafted using the [Release-Drafter Action](https://github.com/marketplace/actions/release-drafter)

3. `Kitchen test` runs on PR, merge to main and releases.
3. `terraform test` runs on PR, merge to main and releases.
6 changes: 3 additions & 3 deletions tests/simple-vpc.tftest.hcl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
run "create_vpc" {
command = plan
run "simple_vpc_test" {

module "simple-project" {
module {
source = "./tests/simple-vpc/"
}

assert {
condition = module.simple-project.project_id != ""
Expand Down
2 changes: 1 addition & 1 deletion tests/simple-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
}

module "simple-project" {
source = "git::https://github.com/BrownUniversity/terraform-gcp-project.git?ref=v0.1.5"
source = "git::https://github.com/BrownUniversity/terraform-gcp-project.git?ref=v0.1.6"
project_name = "inspec-vpc"
folder_id = var.folder_id
billing_account = var.billing_account
Expand Down

0 comments on commit 5d9d6b6

Please sign in to comment.