From 2f0e09cef9c29bbe0059fb962fd56d02236c04f4 Mon Sep 17 00:00:00 2001 From: Gary Crye Date: Wed, 12 Jul 2023 13:00:32 -0600 Subject: [PATCH] Flatten TF module structure via `.tfvars`/`.tfbackend`, update to TF v1.5.3 --- .github/workflows/ci-iac.yml | 18 ++--- .github/workflows/deploy.yml | 20 +++--- .../{cpy => }/app/.terraform.lock.hcl | 34 +++++----- terraform-iac/app/cpy.s3.tfbackend | 3 + terraform-iac/app/cpy.tfvars | 7 ++ terraform-iac/app/dev.s3.tfbackend | 3 + terraform-iac/app/dev.tfvars | 7 ++ terraform-iac/{modules => }/app/main.tf | 38 ++++++++++- terraform-iac/app/prd.s3.tfbackend | 3 + terraform-iac/app/prd.tfvars | 7 ++ terraform-iac/app/stg.s3.tfbackend | 3 + terraform-iac/app/stg.tfvars | 7 ++ terraform-iac/cpy/app/cpy-app.tf | 67 ------------------- terraform-iac/cpy/setup/.terraform.lock.hcl | 45 ------------- terraform-iac/cpy/setup/cpy-setup.tf | 48 ------------- terraform-iac/dev/app/.terraform.lock.hcl | 45 ------------- terraform-iac/dev/app/dev-app.tf | 67 ------------------- terraform-iac/dev/setup/.terraform.lock.hcl | 45 ------------- terraform-iac/dev/setup/dev-setup.tf | 48 ------------- terraform-iac/prd/app/.terraform.lock.hcl | 45 ------------- terraform-iac/prd/app/prd-app.tf | 67 ------------------- terraform-iac/prd/setup/prd-setup.tf | 48 ------------- .../{prd => }/setup/.terraform.lock.hcl | 34 +++++----- terraform-iac/setup/cpy.s3.tfbackend | 3 + terraform-iac/setup/dev.s3.tfbackend | 3 + terraform-iac/setup/prd.s3.tfbackend | 3 + terraform-iac/{modules => }/setup/setup.tf | 39 ++++++++++- terraform-iac/setup/stg.s3.tfbackend | 3 + terraform-iac/stg/app/.terraform.lock.hcl | 45 ------------- terraform-iac/stg/app/stg-app.tf | 66 ------------------ terraform-iac/stg/setup/.terraform.lock.hcl | 45 ------------- terraform-iac/stg/setup/stg-setup.tf | 48 ------------- 32 files changed, 174 insertions(+), 790 deletions(-) rename terraform-iac/{cpy => }/app/.terraform.lock.hcl (52%) create mode 100644 terraform-iac/app/cpy.s3.tfbackend create mode 100644 terraform-iac/app/cpy.tfvars create mode 100644 terraform-iac/app/dev.s3.tfbackend create mode 100644 terraform-iac/app/dev.tfvars rename terraform-iac/{modules => }/app/main.tf (89%) create mode 100644 terraform-iac/app/prd.s3.tfbackend create mode 100644 terraform-iac/app/prd.tfvars create mode 100644 terraform-iac/app/stg.s3.tfbackend create mode 100644 terraform-iac/app/stg.tfvars delete mode 100644 terraform-iac/cpy/app/cpy-app.tf delete mode 100644 terraform-iac/cpy/setup/.terraform.lock.hcl delete mode 100644 terraform-iac/cpy/setup/cpy-setup.tf delete mode 100644 terraform-iac/dev/app/.terraform.lock.hcl delete mode 100644 terraform-iac/dev/app/dev-app.tf delete mode 100644 terraform-iac/dev/setup/.terraform.lock.hcl delete mode 100644 terraform-iac/dev/setup/dev-setup.tf delete mode 100644 terraform-iac/prd/app/.terraform.lock.hcl delete mode 100644 terraform-iac/prd/app/prd-app.tf delete mode 100644 terraform-iac/prd/setup/prd-setup.tf rename terraform-iac/{prd => }/setup/.terraform.lock.hcl (52%) create mode 100644 terraform-iac/setup/cpy.s3.tfbackend create mode 100644 terraform-iac/setup/dev.s3.tfbackend create mode 100644 terraform-iac/setup/prd.s3.tfbackend rename terraform-iac/{modules => }/setup/setup.tf (53%) create mode 100644 terraform-iac/setup/stg.s3.tfbackend delete mode 100644 terraform-iac/stg/app/.terraform.lock.hcl delete mode 100644 terraform-iac/stg/app/stg-app.tf delete mode 100644 terraform-iac/stg/setup/.terraform.lock.hcl delete mode 100644 terraform-iac/stg/setup/stg-setup.tf diff --git a/.github/workflows/ci-iac.yml b/.github/workflows/ci-iac.yml index f21dfbdc..23471ba7 100644 --- a/.github/workflows/ci-iac.yml +++ b/.github/workflows/ci-iac.yml @@ -9,7 +9,7 @@ on: - '.github/workflows/ci-iac.yml' env: - tf_version: "1.4.5" # must match value in terraform-iac/*/app/main.tf + tf_version: "1.5.3" # must match value in terraform-iac/app/main.tf jobs: env: @@ -23,7 +23,6 @@ jobs: "env":[ { "environment_name":"dev", - "tf_working_dir":"./terraform-iac/dev/app", "aws_account":"977306314792", "aws_gha_role":"hw-fargate-api-dev-gha" } @@ -38,7 +37,6 @@ jobs: "env":[ { "environment_name":"stg", - "tf_working_dir":"./terraform-iac/stg/app", "aws_account":"977306314792", "aws_gha_role":"hw-fargate-api-stg-gha" } @@ -53,13 +51,11 @@ jobs: "env":[ { "environment_name":"prd", - "tf_working_dir":"./terraform-iac/prd/app", "aws_account":"539738229445", "aws_gha_role":"hw-fargate-api-prd-gha" }, { "environment_name":"cpy", - "tf_working_dir":"./terraform-iac/cpy/app", "aws_account":"539738229445", "aws_gha_role":"hw-fargate-api-cpy-gha" } @@ -113,18 +109,18 @@ jobs: terraform_version: ${{ env.tf_version }} - name: Terraform Init - working-directory: ${{ matrix.env.tf_working_dir }} - run: terraform init + working-directory: terraform-iac/app + run: terraform init -backend-config=${{ matrix.env.environment_name }}.s3.tfbackend - name: Terraform Plan - working-directory: ${{ matrix.env.tf_working_dir }} - run: terraform plan -var 'image_tag=ci_test' -input=false -out plan -lock=false + working-directory: terraform-iac/app + run: terraform plan -var-file=${{ matrix.env.environment_name }}.tfvars -var 'image_tag=ci_test' -input=false -out plan -lock=false - name: Comment Terraform Plan uses: byu-oit/github-action-tf-plan-comment@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} - working-directory: ${{ matrix.env.tf_working_dir }} + working-directory: terraform-iac/app terraform-plan-file: plan - name: Analyze Terraform Plan @@ -132,7 +128,7 @@ jobs: if: github.repository_owner == 'byu-oit' # If you're at BYU, but outside the byu-oit GitHub org, you may be able to obtain credentials by contacting cloudoffice@byu.edu with: - working-directory: ${{ matrix.env.tf_working_dir }} + working-directory: terraform-iac/app terraform-plan-file: plan divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }} divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bb041fbc..b66e8c2c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,7 @@ on: - '.gitignore' env: node_version: "18.x" - tf_version: "1.4.5" # must match value in terraform-iac/*/app/main.tf + tf_version: "1.5.3" # must match value in terraform-iac/app/main.tf FORCE_COLOR: 3 concurrency: ${{ github.ref }} jobs: @@ -25,7 +25,6 @@ jobs: { "environment_name":"dev", "ecr_repo_name":"hw-fargate-api-dev", - "tf_working_dir":"./terraform-iac/dev/app", "aws_account":"977306314792", "aws_gha_role":"hw-fargate-api-dev-gha", "rfc_key_name":"standard_change_sandbox_client_key", @@ -44,7 +43,6 @@ jobs: { "environment_name":"stg", "ecr_repo_name":"hw-fargate-api-stg", - "tf_working_dir":"./terraform-iac/stg/app", "aws_account":"977306314792", "aws_gha_role":"hw-fargate-api-stg-gha", "rfc_key_name":"standard_change_sandbox_client_key", @@ -67,7 +65,6 @@ jobs: { "environment_name":"prd", "ecr_repo_name":"hw-fargate-api-prd", - "tf_working_dir":"./terraform-iac/prd/app", "aws_account":"539738229445", "aws_gha_role":"hw-fargate-api-prd-gha", "rfc_key_name":"standard_change_sandbox_client_key", @@ -77,7 +74,6 @@ jobs: { "environment_name":"cpy", "ecr_repo_name":"hw-fargate-api-cpy", - "tf_working_dir":"./terraform-iac/cpy/app", "aws_account":"539738229445", "aws_gha_role":"hw-fargate-api-cpy-gha", "rfc_key_name":"standard_change_sandbox_client_key", @@ -245,19 +241,19 @@ jobs: terraform_wrapper: false - name: Terraform Init - working-directory: ${{ matrix.env.tf_working_dir }} - run: terraform init + working-directory: terraform-iac/app + run: terraform init -backend-config=${{ matrix.env.environment_name }}.s3.tfbackend - name: Terraform Plan - working-directory: ${{ matrix.env.tf_working_dir }} - run: terraform plan -var 'image_tag=${{ steps.date.outputs.timestamp }}' -input=false -out=plan + working-directory: terraform-iac/app + run: terraform plan -var-file=${{ matrix.env.environment_name }}.tfvars -var 'image_tag=${{ steps.date.outputs.timestamp }}' -input=false -out=plan - name: Analyze Terraform Plan uses: byu-oit/github-action-tf-plan-analyzer@v2 if: github.repository_owner == 'byu-oit' # If you're at BYU, but outside the byu-oit GitHub org, you may be able to obtain credentials by contacting cloudoffice@byu.edu with: - working-directory: ${{ matrix.env.tf_working_dir }} + working-directory: terraform-iac/app terraform-plan-file: plan divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }} divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }} @@ -271,12 +267,12 @@ jobs: template-id: ${{ matrix.env.rfc_template_id }} - name: Terraform Apply - working-directory: ${{ matrix.env.tf_working_dir }} + working-directory: terraform-iac/app run: terraform apply plan - name: Get Terraform Outputs id: terraform-outputs - working-directory: ${{ matrix.env.tf_working_dir }} + working-directory: terraform-iac/app run: | echo "codedeploy_app_name=$(terraform output -raw codedeploy_app_name)" >> $GITHUB_OUTPUT echo "codedeploy_deployment_group_name=$(terraform output -raw codedeploy_deployment_group_name)" >> $GITHUB_OUTPUT diff --git a/terraform-iac/cpy/app/.terraform.lock.hcl b/terraform-iac/app/.terraform.lock.hcl similarity index 52% rename from terraform-iac/cpy/app/.terraform.lock.hcl rename to terraform-iac/app/.terraform.lock.hcl index a8cf5a26..13d20cb6 100644 --- a/terraform-iac/cpy/app/.terraform.lock.hcl +++ b/terraform-iac/app/.terraform.lock.hcl @@ -2,25 +2,25 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" + version = "4.67.0" constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 4.65" hashes = [ - "h1:ZEdurVGkjkOZzhJijFTF+3djXZ9N4Js8Ss6tM43n3HA=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", + "h1:xzpipYzqP0dTwotCNTD+4DsIPOGoXlYsX3nJDqHRrZM=", + "zh:0843017ecc24385f2b45f2c5fce79dc25b258e50d516877b3affee3bef34f060", + "zh:19876066cfa60de91834ec569a6448dab8c2518b8a71b5ca870b2444febddac6", + "zh:24995686b2ad88c1ffaa242e36eee791fc6070e6144f418048c4ce24d0ba5183", + "zh:4a002990b9f4d6d225d82cb2fb8805789ffef791999ee5d9cb1fef579aeff8f1", + "zh:559a2b5ace06b878c6de3ecf19b94fbae3512562f7a51e930674b16c2f606e29", + "zh:6a07da13b86b9753b95d4d8218f6dae874cf34699bca1470d6effbb4dee7f4b7", + "zh:768b3bfd126c3b77dc975c7c0e5db3207e4f9997cf41aa3385c63206242ba043", + "zh:7be5177e698d4b547083cc738b977742d70ed68487ce6f49ecd0c94dbf9d1362", + "zh:8b562a818915fb0d85959257095251a05c76f3467caa3ba95c583ba5fe043f9b", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", + "zh:9c385d03a958b54e2afd5279cd8c7cbdd2d6ca5c7d6a333e61092331f38af7cf", + "zh:b3ca45f2821a89af417787df8289cb4314b273d29555ad3b2a5ab98bb4816b3b", + "zh:da3c317f1db2469615ab40aa6baba63b5643bae7110ff855277a1fb9d8eb4f2c", + "zh:dc6430622a8dc5cdab359a8704aec81d3825ea1d305bbb3bbd032b1c6adfae0c", + "zh:fac0d2ddeadf9ec53da87922f666e1e73a603a611c57bcbc4b86ac2821619b1d", ] } @@ -28,7 +28,7 @@ provider "registry.terraform.io/hashicorp/local" { version = "2.4.0" constraints = "~> 2.4" hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", + "h1:sfyLOvWTFeT1dlRURlE2HpIUOOX9SB16Kgi6KPp0Oxs=", "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", diff --git a/terraform-iac/app/cpy.s3.tfbackend b/terraform-iac/app/cpy.s3.tfbackend new file mode 100644 index 00000000..866b9a42 --- /dev/null +++ b/terraform-iac/app/cpy.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-539738229445" +dynamodb_table = "terraform-state-lock-539738229445" +key = "hw-fargate-api/cpy/app.tfstate" diff --git a/terraform-iac/app/cpy.tfvars b/terraform-iac/app/cpy.tfvars new file mode 100644 index 00000000..92fd9aef --- /dev/null +++ b/terraform-iac/app/cpy.tfvars @@ -0,0 +1,7 @@ +env = "cpy" + +# image_tag provided by pipeline (or user) +codedeploy_termination_wait_time = 0 +deploy_test_postman_collection = "../../.postman/hw-fargate-api.postman_collection.json" +deploy_test_postman_environment = "../../.postman/cpy-tst.postman_environment.json" +log_retention_days = 7 diff --git a/terraform-iac/app/dev.s3.tfbackend b/terraform-iac/app/dev.s3.tfbackend new file mode 100644 index 00000000..bd58b23c --- /dev/null +++ b/terraform-iac/app/dev.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-977306314792" +dynamodb_table = "terraform-state-lock-977306314792" +key = "hw-fargate-api/dev/app.tfstate" diff --git a/terraform-iac/app/dev.tfvars b/terraform-iac/app/dev.tfvars new file mode 100644 index 00000000..af9c08ee --- /dev/null +++ b/terraform-iac/app/dev.tfvars @@ -0,0 +1,7 @@ +env = "dev" + +# image_tag provided by pipeline (or user) +codedeploy_termination_wait_time = 0 +deploy_test_postman_collection = "../../.postman/hw-fargate-api.postman_collection.json" +deploy_test_postman_environment = "../../.postman/dev-tst.postman_environment.json" +log_retention_days = 1 diff --git a/terraform-iac/modules/app/main.tf b/terraform-iac/app/main.tf similarity index 89% rename from terraform-iac/modules/app/main.tf rename to terraform-iac/app/main.tf index c435f065..1c4edba7 100644 --- a/terraform-iac/modules/app/main.tf +++ b/terraform-iac/app/main.tf @@ -1,3 +1,36 @@ +terraform { + required_version = "1.5.3" + backend "s3" { + # The rest of the backend config is passed in + # https://developer.hashicorp.com/terraform/language/settings/backends/configuration#partial-configuration + region = "us-west-2" + } + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.65" + } + local = { + source = "hashicorp/local" + version = "~> 2.4" + } + } +} + +provider "aws" { + region = "us-west-2" + + default_tags { + tags = { + app = local.name + repo = "https://github.com/${local.gh_org}/${local.gh_repo}" + data-sensitivity = "public" + env = var.env + resource-creator-email = "GitHub-Actions" + } + } +} + variable "env" { type = string } @@ -23,8 +56,9 @@ variable "log_retention_days" { } locals { - name = "hw-fargate-api" - env = var.env + name = "hw-fargate-api" + gh_org = "byu-oit" + gh_repo = "hw-fargate-api" } data "aws_ecr_repository" "my_ecr_repo" { diff --git a/terraform-iac/app/prd.s3.tfbackend b/terraform-iac/app/prd.s3.tfbackend new file mode 100644 index 00000000..6afe3b6a --- /dev/null +++ b/terraform-iac/app/prd.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-539738229445" +dynamodb_table = "terraform-state-lock-539738229445" +key = "hw-fargate-api/prd/app.tfstate" diff --git a/terraform-iac/app/prd.tfvars b/terraform-iac/app/prd.tfvars new file mode 100644 index 00000000..0c21686b --- /dev/null +++ b/terraform-iac/app/prd.tfvars @@ -0,0 +1,7 @@ +env = "prd" + +# image_tag provided by pipeline (or user) +codedeploy_termination_wait_time = 0 # You probably want to change this to 15 when your service is really prd +deploy_test_postman_collection = "../../.postman/hw-fargate-api.postman_collection.json" +deploy_test_postman_environment = "../../.postman/prd-tst.postman_environment.json" +log_retention_days = 7 diff --git a/terraform-iac/app/stg.s3.tfbackend b/terraform-iac/app/stg.s3.tfbackend new file mode 100644 index 00000000..7bd08010 --- /dev/null +++ b/terraform-iac/app/stg.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-977306314792" +dynamodb_table = "terraform-state-lock-977306314792" +key = "hw-fargate-api/stg/app.tfstate" diff --git a/terraform-iac/app/stg.tfvars b/terraform-iac/app/stg.tfvars new file mode 100644 index 00000000..657a033c --- /dev/null +++ b/terraform-iac/app/stg.tfvars @@ -0,0 +1,7 @@ +env = "stg" + +# image_tag provided by pipeline (or user) +codedeploy_termination_wait_time = 0 +deploy_test_postman_collection = "../../.postman/hw-fargate-api.postman_collection.json" +deploy_test_postman_environment = "../../.postman/stg-tst.postman_environment.json" +log_retention_days = 1 diff --git a/terraform-iac/cpy/app/cpy-app.tf b/terraform-iac/cpy/app/cpy-app.tf deleted file mode 100644 index 473a6ce0..00000000 --- a/terraform-iac/cpy/app/cpy-app.tf +++ /dev/null @@ -1,67 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-539738229445" - dynamodb_table = "terraform-state-lock-539738229445" - key = "hw-fargate-api/cpy/app.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "cpy" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "image_tag" { - type = string -} - -module "app" { - source = "../../modules/app/" - env = local.env - image_tag = var.image_tag - codedeploy_termination_wait_time = 0 # you probably want to change this to 15 when your service is really prd - deploy_test_postman_collection = "../../../.postman/hw-fargate-api.postman_collection.json" - deploy_test_postman_environment = "../../../.postman/cpy-tst.postman_environment.json" - log_retention_days = 7 -} - -output "url" { - value = module.app.url -} - -output "codedeploy_app_name" { - value = module.app.codedeploy_app_name -} - -output "codedeploy_deployment_group_name" { - value = module.app.codedeploy_deployment_group_name -} - -output "codedeploy_appspec_json_file" { - value = module.app.codedeploy_appspec_json_file -} diff --git a/terraform-iac/cpy/setup/.terraform.lock.hcl b/terraform-iac/cpy/setup/.terraform.lock.hcl deleted file mode 100644 index be7c1ddd..00000000 --- a/terraform-iac/cpy/setup/.terraform.lock.hcl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" - constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 4.65" - hashes = [ - "h1:5wuy+3DsBkb8mijzuzwut9ND8UO7gZN49PUL4gtx9us=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - constraints = "~> 2.4" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} diff --git a/terraform-iac/cpy/setup/cpy-setup.tf b/terraform-iac/cpy/setup/cpy-setup.tf deleted file mode 100644 index 4d6e2f4b..00000000 --- a/terraform-iac/cpy/setup/cpy-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-539738229445" - dynamodb_table = "terraform-state-lock-539738229445" - key = "hw-fargate-api/cpy/setup.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "cpy" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "some_secret" { - type = string - description = "Some secret string that will be stored in SSM and mounted into the Fargate Tasks as an environment variable" -} - -module "setup" { - source = "../../modules/setup/" - env = local.env - some_secret = var.some_secret -} diff --git a/terraform-iac/dev/app/.terraform.lock.hcl b/terraform-iac/dev/app/.terraform.lock.hcl deleted file mode 100644 index a8cf5a26..00000000 --- a/terraform-iac/dev/app/.terraform.lock.hcl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" - constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 4.65" - hashes = [ - "h1:ZEdurVGkjkOZzhJijFTF+3djXZ9N4Js8Ss6tM43n3HA=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - constraints = "~> 2.4" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} diff --git a/terraform-iac/dev/app/dev-app.tf b/terraform-iac/dev/app/dev-app.tf deleted file mode 100644 index 2d00fd05..00000000 --- a/terraform-iac/dev/app/dev-app.tf +++ /dev/null @@ -1,67 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-977306314792" - dynamodb_table = "terraform-state-lock-977306314792" - key = "hw-fargate-api/dev/app.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "dev" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "image_tag" { - type = string -} - -module "app" { - source = "../../modules/app/" - env = local.env - image_tag = var.image_tag - codedeploy_termination_wait_time = 0 - deploy_test_postman_collection = "../../../.postman/hw-fargate-api.postman_collection.json" - deploy_test_postman_environment = "../../../.postman/dev-tst.postman_environment.json" - log_retention_days = 1 -} - -output "url" { - value = module.app.url -} - -output "codedeploy_app_name" { - value = module.app.codedeploy_app_name -} - -output "codedeploy_deployment_group_name" { - value = module.app.codedeploy_deployment_group_name -} - -output "codedeploy_appspec_json_file" { - value = module.app.codedeploy_appspec_json_file -} diff --git a/terraform-iac/dev/setup/.terraform.lock.hcl b/terraform-iac/dev/setup/.terraform.lock.hcl deleted file mode 100644 index 72a9063b..00000000 --- a/terraform-iac/dev/setup/.terraform.lock.hcl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" - constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 4.65" - hashes = [ - "h1:ZEdurVGkjkOZzhJijFTF+3djXZ9N4Js8Ss6tM43n3HA=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - constraints = "~> 2.4" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} diff --git a/terraform-iac/dev/setup/dev-setup.tf b/terraform-iac/dev/setup/dev-setup.tf deleted file mode 100644 index 2a240661..00000000 --- a/terraform-iac/dev/setup/dev-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-977306314792" - dynamodb_table = "terraform-state-lock-977306314792" - key = "hw-fargate-api/dev/setup.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "dev" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "some_secret" { - type = string - description = "Some secret string that will be stored in SSM and mounted into the Fargate Tasks as an environment variable" -} - -module "setup" { - source = "../../modules/setup/" - env = local.env - some_secret = var.some_secret -} diff --git a/terraform-iac/prd/app/.terraform.lock.hcl b/terraform-iac/prd/app/.terraform.lock.hcl deleted file mode 100644 index a8cf5a26..00000000 --- a/terraform-iac/prd/app/.terraform.lock.hcl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" - constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 4.65" - hashes = [ - "h1:ZEdurVGkjkOZzhJijFTF+3djXZ9N4Js8Ss6tM43n3HA=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - constraints = "~> 2.4" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} diff --git a/terraform-iac/prd/app/prd-app.tf b/terraform-iac/prd/app/prd-app.tf deleted file mode 100644 index 12cc8b4a..00000000 --- a/terraform-iac/prd/app/prd-app.tf +++ /dev/null @@ -1,67 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-539738229445" - dynamodb_table = "terraform-state-lock-539738229445" - key = "hw-fargate-api/prd/app.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "prd" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "image_tag" { - type = string -} - -module "app" { - source = "../../modules/app/" - env = local.env - image_tag = var.image_tag - codedeploy_termination_wait_time = 0 # you probably want to change this to 15 when your service is really prd - deploy_test_postman_collection = "../../../.postman/hw-fargate-api.postman_collection.json" - deploy_test_postman_environment = "../../../.postman/prd-tst.postman_environment.json" - log_retention_days = 7 -} - -output "url" { - value = module.app.url -} - -output "codedeploy_app_name" { - value = module.app.codedeploy_app_name -} - -output "codedeploy_deployment_group_name" { - value = module.app.codedeploy_deployment_group_name -} - -output "codedeploy_appspec_json_file" { - value = module.app.codedeploy_appspec_json_file -} diff --git a/terraform-iac/prd/setup/prd-setup.tf b/terraform-iac/prd/setup/prd-setup.tf deleted file mode 100644 index c01917d6..00000000 --- a/terraform-iac/prd/setup/prd-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-539738229445" - dynamodb_table = "terraform-state-lock-539738229445" - key = "hw-fargate-api/prd/setup.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "prd" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "some_secret" { - type = string - description = "Some secret string that will be stored in SSM and mounted into the Fargate Tasks as an environment variable" -} - -module "setup" { - source = "../../modules/setup/" - env = local.env - some_secret = var.some_secret -} diff --git a/terraform-iac/prd/setup/.terraform.lock.hcl b/terraform-iac/setup/.terraform.lock.hcl similarity index 52% rename from terraform-iac/prd/setup/.terraform.lock.hcl rename to terraform-iac/setup/.terraform.lock.hcl index 72a9063b..18fce43c 100644 --- a/terraform-iac/prd/setup/.terraform.lock.hcl +++ b/terraform-iac/setup/.terraform.lock.hcl @@ -2,25 +2,25 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" + version = "4.67.0" constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 4.65" hashes = [ - "h1:ZEdurVGkjkOZzhJijFTF+3djXZ9N4Js8Ss6tM43n3HA=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", + "h1:xzpipYzqP0dTwotCNTD+4DsIPOGoXlYsX3nJDqHRrZM=", + "zh:0843017ecc24385f2b45f2c5fce79dc25b258e50d516877b3affee3bef34f060", + "zh:19876066cfa60de91834ec569a6448dab8c2518b8a71b5ca870b2444febddac6", + "zh:24995686b2ad88c1ffaa242e36eee791fc6070e6144f418048c4ce24d0ba5183", + "zh:4a002990b9f4d6d225d82cb2fb8805789ffef791999ee5d9cb1fef579aeff8f1", + "zh:559a2b5ace06b878c6de3ecf19b94fbae3512562f7a51e930674b16c2f606e29", + "zh:6a07da13b86b9753b95d4d8218f6dae874cf34699bca1470d6effbb4dee7f4b7", + "zh:768b3bfd126c3b77dc975c7c0e5db3207e4f9997cf41aa3385c63206242ba043", + "zh:7be5177e698d4b547083cc738b977742d70ed68487ce6f49ecd0c94dbf9d1362", + "zh:8b562a818915fb0d85959257095251a05c76f3467caa3ba95c583ba5fe043f9b", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", + "zh:9c385d03a958b54e2afd5279cd8c7cbdd2d6ca5c7d6a333e61092331f38af7cf", + "zh:b3ca45f2821a89af417787df8289cb4314b273d29555ad3b2a5ab98bb4816b3b", + "zh:da3c317f1db2469615ab40aa6baba63b5643bae7110ff855277a1fb9d8eb4f2c", + "zh:dc6430622a8dc5cdab359a8704aec81d3825ea1d305bbb3bbd032b1c6adfae0c", + "zh:fac0d2ddeadf9ec53da87922f666e1e73a603a611c57bcbc4b86ac2821619b1d", ] } @@ -28,7 +28,7 @@ provider "registry.terraform.io/hashicorp/local" { version = "2.4.0" constraints = "~> 2.4" hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", + "h1:sfyLOvWTFeT1dlRURlE2HpIUOOX9SB16Kgi6KPp0Oxs=", "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", diff --git a/terraform-iac/setup/cpy.s3.tfbackend b/terraform-iac/setup/cpy.s3.tfbackend new file mode 100644 index 00000000..5d308050 --- /dev/null +++ b/terraform-iac/setup/cpy.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-539738229445" +dynamodb_table = "terraform-state-lock-539738229445" +key = "hw-fargate-api/cpy/setup.tfstate" \ No newline at end of file diff --git a/terraform-iac/setup/dev.s3.tfbackend b/terraform-iac/setup/dev.s3.tfbackend new file mode 100644 index 00000000..9715ad9d --- /dev/null +++ b/terraform-iac/setup/dev.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-977306314792" +dynamodb_table = "terraform-state-lock-977306314792" +key = "hw-fargate-api/dev/setup.tfstate" diff --git a/terraform-iac/setup/prd.s3.tfbackend b/terraform-iac/setup/prd.s3.tfbackend new file mode 100644 index 00000000..1e5d70c3 --- /dev/null +++ b/terraform-iac/setup/prd.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-539738229445" +dynamodb_table = "terraform-state-lock-539738229445" +key = "hw-fargate-api/prd/setup.tfstate" diff --git a/terraform-iac/modules/setup/setup.tf b/terraform-iac/setup/setup.tf similarity index 53% rename from terraform-iac/modules/setup/setup.tf rename to terraform-iac/setup/setup.tf index 5cd60f8f..1b51010e 100644 --- a/terraform-iac/modules/setup/setup.tf +++ b/terraform-iac/setup/setup.tf @@ -1,9 +1,44 @@ +terraform { + required_version = "1.5.3" + backend "s3" { + # The rest of the backend config is passed in + # https://developer.hashicorp.com/terraform/language/settings/backends/configuration#partial-configuration + region = "us-west-2" + } + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.65" + } + local = { + source = "hashicorp/local" + version = "~> 2.4" + } + } +} + +provider "aws" { + region = "us-west-2" + + default_tags { + tags = { + app = local.name + repo = "https://github.com/${local.gh_org}/${local.gh_repo}" + data-sensitivity = "public" + env = var.env + resource-creator-email = "GitHub-Actions" + } + } +} + variable "env" { - type = string + type = string + description = "Environment: dev, stg, cpy, or prd" } variable "some_secret" { - type = string + type = string + description = "Some secret string that will be stored in SSM and mounted into the Fargate Tasks as an environment variable" } locals { diff --git a/terraform-iac/setup/stg.s3.tfbackend b/terraform-iac/setup/stg.s3.tfbackend new file mode 100644 index 00000000..fb9b5d6d --- /dev/null +++ b/terraform-iac/setup/stg.s3.tfbackend @@ -0,0 +1,3 @@ +bucket = "terraform-state-storage-977306314792" +dynamodb_table = "terraform-state-lock-977306314792" +key = "hw-fargate-api/stg/setup.tfstate" diff --git a/terraform-iac/stg/app/.terraform.lock.hcl b/terraform-iac/stg/app/.terraform.lock.hcl deleted file mode 100644 index a8cf5a26..00000000 --- a/terraform-iac/stg/app/.terraform.lock.hcl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" - constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 4.65" - hashes = [ - "h1:ZEdurVGkjkOZzhJijFTF+3djXZ9N4Js8Ss6tM43n3HA=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - constraints = "~> 2.4" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} diff --git a/terraform-iac/stg/app/stg-app.tf b/terraform-iac/stg/app/stg-app.tf deleted file mode 100644 index 4dd0a952..00000000 --- a/terraform-iac/stg/app/stg-app.tf +++ /dev/null @@ -1,66 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-977306314792" - dynamodb_table = "terraform-state-lock-977306314792" - key = "hw-fargate-api/stg/app.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "stg" -} - -provider "aws" { - region = "us-west-2" - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "image_tag" { - type = string -} - -module "app" { - source = "../../modules/app/" - env = local.env - image_tag = var.image_tag - codedeploy_termination_wait_time = 0 - deploy_test_postman_collection = "../../../.postman/hw-fargate-api.postman_collection.json" - deploy_test_postman_environment = "../../../.postman/stg-tst.postman_environment.json" - log_retention_days = 1 -} - -output "url" { - value = module.app.url -} - -output "codedeploy_app_name" { - value = module.app.codedeploy_app_name -} - -output "codedeploy_deployment_group_name" { - value = module.app.codedeploy_deployment_group_name -} - -output "codedeploy_appspec_json_file" { - value = module.app.codedeploy_appspec_json_file -} diff --git a/terraform-iac/stg/setup/.terraform.lock.hcl b/terraform-iac/stg/setup/.terraform.lock.hcl deleted file mode 100644 index b314143a..00000000 --- a/terraform-iac/stg/setup/.terraform.lock.hcl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "4.65.0" - constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 4.65" - hashes = [ - "h1:uqSgF/1x8sCbok4AIZpt0yqJk1WHCq9FYhX3B35KKgE=", - "zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9", - "zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b", - "zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64", - "zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a", - "zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7", - "zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207", - "zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8", - "zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544", - "zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07", - "zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483", - "zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88", - "zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef", - "zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - constraints = "~> 2.4" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} diff --git a/terraform-iac/stg/setup/stg-setup.tf b/terraform-iac/stg/setup/stg-setup.tf deleted file mode 100644 index 792e3e25..00000000 --- a/terraform-iac/stg/setup/stg-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.4.5" - backend "s3" { - bucket = "terraform-state-storage-977306314792" - dynamodb_table = "terraform-state-lock-977306314792" - key = "hw-fargate-api/stg/setup.tfstate" - region = "us-west-2" - } - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.65" - } - local = { - source = "hashicorp/local" - version = "~> 2.4" - } - } -} - -locals { - env = "stg" -} - -provider "aws" { - region = "us-west-2" - - default_tags { - tags = { - app = "hw-fargate-api" - repo = "https://github.com/byu-oit/hw-fargate-api" - data-sensitivity = "public" - env = local.env - resource-creator-email = "GitHub-Actions" - } - } -} - -variable "some_secret" { - type = string - description = "Some secret string that will be stored in SSM and mounted into the Fargate Tasks as an environment variable" -} - -module "setup" { - source = "../../modules/setup/" - env = local.env - some_secret = var.some_secret -}