From 5d9d6b608002939b3b23e74f264e7952e0aa9a6a Mon Sep 17 00:00:00 2001 From: Paul Xu Date: Fri, 19 Jul 2024 14:06:11 -0400 Subject: [PATCH] update project module version --- .terraform.lock.hcl | 102 ++++++++++++++++++++++++++++++++++++ README.md | 39 +++----------- tests/simple-vpc.tftest.hcl | 6 +-- tests/simple-vpc/main.tf | 2 +- 4 files changed, 114 insertions(+), 35 deletions(-) create mode 100644 .terraform.lock.hcl diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl new file mode 100644 index 0000000..2e47a47 --- /dev/null +++ b/.terraform.lock.hcl @@ -0,0 +1,102 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/google" { + version = "5.38.0" + constraints = ">= 3.33.0, >= 3.43.0, >= 3.53.0, >= 3.83.0, >= 4.25.0, >= 4.28.0, >= 4.64.0, >= 5.22.0, 5.38.0, < 6.0.0" + hashes = [ + "h1:5xqoIwJbuXeHvq2NVt9S783fGS05hQUHg1AnnIJ+6EI=", + "zh:0db794dfbd4d3604499f1a4011faf7aa3f4c07eace32aa238bdf0b235965259a", + "zh:372f399f67c7e320c25e71d5a2c4c9bad6b4f9b35f7fcdc86fb5009711e34751", + "zh:a010ff05ea62396ee5d0771c614a7e6abd6a869e8ee9b7d9da0747eb4b10f2ba", + "zh:a416a2d7784436409a317cdf42a82eaf98d0f2d935bb5bacb50820f88207e1d9", + "zh:b3926e2295604c87aae81f305d0d1960157a734811ec0b3324f933c8c2421b1a", + "zh:c317d75cf290fac34be9438c14ecf8a9f80f966823e5346020fe7b6c6281259b", + "zh:c97127635c25cc72fc3e2d6bb48b2e9f88730b3c46629bdc335e391791ad53da", + "zh:ccfd23ad869c3bd2037a231718dea44e42c12cff605880edbb37c46255bd1e91", + "zh:dfd389432df9084e54c32809ab960058bafa002393a051640d11bf70533f1cc7", + "zh:ecb5b65be8188a51b19b37be587797a72b238bbdc252aee2e1e22dd5f59e20df", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + "zh:fa5f5d9bce05bb02ef58bead70e4b8653feb98293eb4e0d95bce58b3b1f0a943", + ] +} + +provider "registry.terraform.io/hashicorp/google-beta" { + version = "5.38.0" + constraints = ">= 3.43.0, >= 4.11.0, >= 4.64.0, >= 5.22.0, < 6.0.0" + hashes = [ + "h1:Q4bKg0gqqOa3IUks206PqHTTyDM0LsLB/lwpn0AALnk=", + "zh:19b33b874b1aa47699dfefc2691464932d6974fbe14bff7b60e0f64b3142e334", + "zh:215f675174d4074f11226f5c48b75880b59c2d56f0ae22ae3ea16012023b68e3", + "zh:22bc73738a7a57e3a022b28bdb34039da07cc105c1f46b288002c02b05c05a71", + "zh:4876a02bc040c98fb662e985a78caecd2b6a7355480362648ff36826e45d09fa", + "zh:899a64484ea44092dd0822478032e87f661dd85e8d735adbb553f7796d7ee497", + "zh:991990de697bd32066e4f2b67aa10c59b84e18f75170be976e75fb711cd0070f", + "zh:a4db4d424c060c0e8f686b0fb714aa7d41e3a5ba20d6aba05496eb8c6e635a3d", + "zh:a988d8a24e673aeff6b1a298d731ed69ef63bba7af9cd4ceb5c51834eecf9fde", + "zh:be3855a320cc44b1936c0778c9cbcaebe92435a2d5eef1f6e5a967ce2a3dc01e", + "zh:e26c72bc15ae27a3a6a99ed0f60ed38f2fca54a310c7ddfee3126b93fb90509e", + "zh:efbe757f0764a1dd69d23a440c03eaf69a8e5742ad63e814212611a16d769eb6", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + ] +} + +provider "registry.terraform.io/hashicorp/null" { + version = "3.2.2" + constraints = ">= 2.1.0" + hashes = [ + "h1:IMVAUHKoydFrlPrl9OzasDnw/8ntZFerCC9iXw1rXQY=", + "zh:3248aae6a2198f3ec8394218d05bd5e42be59f43a3a7c0b71c66ec0df08b69e7", + "zh:32b1aaa1c3013d33c245493f4a65465eab9436b454d250102729321a44c8ab9a", + "zh:38eff7e470acb48f66380a73a5c7cdd76cc9b9c9ba9a7249c7991488abe22fe3", + "zh:4c2f1faee67af104f5f9e711c4574ff4d298afaa8a420680b0cb55d7bbc65606", + "zh:544b33b757c0b954dbb87db83a5ad921edd61f02f1dc86c6186a5ea86465b546", + "zh:696cf785090e1e8cf1587499516b0494f47413b43cb99877ad97f5d0de3dc539", + "zh:6e301f34757b5d265ae44467d95306d61bef5e41930be1365f5a8dcf80f59452", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:913a929070c819e59e94bb37a2a253c228f83921136ff4a7aa1a178c7cce5422", + "zh:aa9015926cd152425dbf86d1abdbc74bfe0e1ba3d26b3db35051d7b9ca9f72ae", + "zh:bb04798b016e1e1d49bcc76d62c53b56c88c63d6f2dfe38821afef17c416a0e1", + "zh:c23084e1b23577de22603cff752e59128d83cfecc2e6819edadd8cf7a10af11e", + ] +} + +provider "registry.terraform.io/hashicorp/random" { + version = "3.6.2" + constraints = ">= 2.2.0" + hashes = [ + "h1:VavG5unYCa3SYISMKF9pzc3718M0bhPlcbUZZGl7wuo=", + "zh:0ef01a4f81147b32c1bea3429974d4d104bbc4be2ba3cfa667031a8183ef88ec", + "zh:1bcd2d8161e89e39886119965ef0f37fcce2da9c1aca34263dd3002ba05fcb53", + "zh:37c75d15e9514556a5f4ed02e1548aaa95c0ecd6ff9af1119ac905144c70c114", + "zh:4210550a767226976bc7e57d988b9ce48f4411fa8a60cd74a6b246baf7589dad", + "zh:562007382520cd4baa7320f35e1370ffe84e46ed4e2071fdc7e4b1a9b1f8ae9b", + "zh:5efb9da90f665e43f22c2e13e0ce48e86cae2d960aaf1abf721b497f32025916", + "zh:6f71257a6b1218d02a573fc9bff0657410404fb2ef23bc66ae8cd968f98d5ff6", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:9647e18f221380a85f2f0ab387c68fdafd58af6193a932417299cdcae4710150", + "zh:bb6297ce412c3c2fa9fec726114e5e0508dd2638cad6a0cb433194930c97a544", + "zh:f83e925ed73ff8a5ef6e3608ad9225baa5376446349572c2449c0c0b3cf184b7", + "zh:fbef0781cb64de76b1df1ca11078aecba7800d82fd4a956302734999cfd9a4af", + ] +} + +provider "registry.terraform.io/hashicorp/time" { + version = "0.12.0" + constraints = ">= 0.5.0" + hashes = [ + "h1:Os2Ok7txtlUJHh6Hg7o+74Ql85SnRb/fGmah22yXpLw=", + "zh:019a4c09af254ef80b72cf0d843dfe72d99483e227138cf5b514a1b9977ab4c3", + "zh:0ae310ec740ebc6f275529507d60bb747d0bf39e72fc5a2fa90d74486006132c", + "zh:13d6aec117f05237fbf8c7d91d6ebb19797b00aa87e7a812642d3ea4738a394e", + "zh:2e87abbc261f9317d0c2ef26e01d5fabf77679da7d2cac6f47df7d198f720989", + "zh:4a6d471176ce0264455aa7d5457b8702f78400010c201c1719708958a1b7b647", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8978d5474a6da30bc0ad21c17db188d6918cacf3df3f6506b72ef3a268d53e2e", + "zh:b109efe138dfcb45dc04a9cc6809d185ab8b0ebc12040847c2dac430fda5af68", + "zh:b58e039b9106ac0a8de3c07f53b5279d7f0215fb35f2d23df642dfce0875382f", + "zh:ba2cbb2e515922d13efe3a46647be84f5426fcfcaa0f1520b3efeab8db847ed3", + "zh:c6c1ef1f26f25bca3abb5e07fa33dca37ed39cc26d0ff877964f2ffe5edd618c", + "zh:f8e171f923b7d2e789abd034072465dec3e6133c3a7644b7a7a965a74d52224e", + ] +} diff --git a/README.md b/README.md index 84ebe2b..ff8027b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/tests/simple-vpc.tftest.hcl b/tests/simple-vpc.tftest.hcl index 5a08232..0bc06b9 100644 --- a/tests/simple-vpc.tftest.hcl +++ b/tests/simple-vpc.tftest.hcl @@ -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 != "" diff --git a/tests/simple-vpc/main.tf b/tests/simple-vpc/main.tf index 3cbf261..92ae7fc 100644 --- a/tests/simple-vpc/main.tf +++ b/tests/simple-vpc/main.tf @@ -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