From a7dfa3c5f7608f5c27661a365f122a1426238466 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` --- .github/workflows/ci-iac.yml | 18 ++--- .github/workflows/deploy.yml | 20 +++--- .../{cpy => }/app/.terraform.lock.hcl | 0 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/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/.terraform.lock.hcl | 45 ------------- terraform-iac/prd/setup/prd-setup.tf | 48 ------------- .../{cpy => }/setup/.terraform.lock.hcl | 0 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, 140 insertions(+), 756 deletions(-) rename terraform-iac/{cpy => }/app/.terraform.lock.hcl (100%) 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/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/.terraform.lock.hcl delete mode 100644 terraform-iac/prd/setup/prd-setup.tf rename terraform-iac/{cpy => }/setup/.terraform.lock.hcl (100%) 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 ceac255c..500e864c 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.7.0" # must match value in terraform-iac/*/app/main.tf + tf_version: "1.7.0" # must match value in terraform-iac/app/main.tf jobs: env: @@ -24,7 +24,6 @@ jobs: "env":[ { "environment_name":"dev", - "tf_working_dir":"./terraform-iac/dev/app", "aws_account":"977306314792", "aws_gha_role":"hw-fargate-api-dev-gha" } @@ -39,7 +38,6 @@ jobs: "env":[ { "environment_name":"stg", - "tf_working_dir":"./terraform-iac/stg/app", "aws_account":"977306314792", "aws_gha_role":"hw-fargate-api-stg-gha" } @@ -54,13 +52,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" } @@ -116,18 +112,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 @@ -135,7 +131,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 69fa1b83..a324a1f9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ on: - '.gitignore' env: node_version: "18.x" - tf_version: "1.7.0" # must match value in terraform-iac/*/app/main.tf + tf_version: "1.7.0" # must match value in terraform-iac/app/main.tf FORCE_COLOR: 3 concurrency: ${{ github.ref }} jobs: @@ -27,7 +27,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", @@ -46,7 +45,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", @@ -69,7 +67,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", @@ -79,7 +76,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", @@ -246,19 +242,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 }} @@ -272,12 +268,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 100% rename from terraform-iac/cpy/app/.terraform.lock.hcl rename to terraform-iac/app/.terraform.lock.hcl 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 bfde79f0..ca6e8b0f 100644 --- a/terraform-iac/modules/app/main.tf +++ b/terraform-iac/app/main.tf @@ -1,3 +1,36 @@ +terraform { + required_version = "1.7.0" + 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 22aaee1a..00000000 --- a/terraform-iac/cpy/app/cpy-app.tf +++ /dev/null @@ -1,67 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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/cpy-setup.tf b/terraform-iac/cpy/setup/cpy-setup.tf deleted file mode 100644 index 571468d5..00000000 --- a/terraform-iac/cpy/setup/cpy-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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 2be7425a..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 = "5.33.0" - constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 5.33" - hashes = [ - "h1:kPm7PkwHh6tZ74pUj5C/QRPtauxdnzrEG2yhCJla/4o=", - "zh:10bb683f2a9306e881f51a971ad3b2bb654ac94b54945dd63769876a343b5b04", - "zh:3916406db958d5487ea0c2d2320012d1907c29e6d01bf693560fe05e38ee0601", - "zh:3cb54b76b2f9e30620f3281ab7fb20633b1e4584fc84cc4ecd5752546252e86f", - "zh:513bcfd6971482215c5d64725189f875cbcbd260c6d11f0da4d66321efd93a92", - "zh:545a34427ebe7a950056627e7c980c9ba16318bf086d300eb808ffc41c52b7a8", - "zh:5a44b90faf1c8e8269f389c04bfac25ad4766d26360e7f7ac371be12a442981c", - "zh:64e1ef83162f78538dccad8b035577738851395ba774d6919cb21eb465a21e3a", - "zh:7315c70cb6b7f975471ea6129474639a08c58c071afc95a36cfaa41a13ae7fb9", - "zh:9806faae58938d638b757f54414400be998dddb45edfd4a29c85e827111dc93d", - "zh:997fa2e2db242354d9f772fba7eb17bd6d18d28480291dd93f85a18ca0a67ac2", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f9e076b7e9752971f39eead6eda69df1c5e890c82ba2ca95f56974af7adfe79", - "zh:b1d6af047f96de7f97d38b685654f1aed4356d5060b0e696d87d0270f5d49f75", - "zh:bfb0654b6f34398aeffdf907b744af06733d168db610a2c5747263380f817ac7", - "zh:e25203ee8cedccf60bf450950d533d3c172509bda8af97dbc3bc817d2a503c57", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.5.1" - constraints = "~> 2.4" - hashes = [ - "h1:/GAVA/xheGQcbOZEq0qxANOg+KVLCA7Wv8qluxhTjhU=", - "zh:0af29ce2b7b5712319bf6424cb58d13b852bf9a777011a545fac99c7fdcdf561", - "zh:126063ea0d79dad1f68fa4e4d556793c0108ce278034f101d1dbbb2463924561", - "zh:196bfb49086f22fd4db46033e01655b0e5e036a5582d250412cc690fa7995de5", - "zh:37c92ec084d059d37d6cffdb683ccf68e3a5f8d2eb69dd73c8e43ad003ef8d24", - "zh:4269f01a98513651ad66763c16b268f4c2da76cc892ccfd54b401fff6cc11667", - "zh:51904350b9c728f963eef0c28f1d43e73d010333133eb7f30999a8fb6a0cc3d8", - "zh:73a66611359b83d0c3fcba2984610273f7954002febb8a57242bbb86d967b635", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7ae387993a92bcc379063229b3cce8af7eaf082dd9306598fcd42352994d2de0", - "zh:9e0f365f807b088646db6e4a8d4b188129d9ebdbcf2568c8ab33bddd1b82c867", - "zh:b5263acbd8ae51c9cbffa79743fbcadcb7908057c87eb22fd9048268056efbc4", - "zh:dfcd88ac5f13c0d04e24be00b686d069b4879cc4add1b7b1a8ae545783d97520", - ] -} diff --git a/terraform-iac/dev/app/dev-app.tf b/terraform-iac/dev/app/dev-app.tf deleted file mode 100644 index edf14204..00000000 --- a/terraform-iac/dev/app/dev-app.tf +++ /dev/null @@ -1,67 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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 68abd042..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 = "5.55.0" - constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 5.33" - hashes = [ - "h1:vChl08zNYLVzuSzfxz3wp3wNSx+vjwl/jPuyPbg59Ks=", - "zh:06fbb1cc4b61b9d6370d391bf7538aa6ef8b60b91c67d125a6be60a70b1d49f0", - "zh:1d52acd2184f379433a0fce2c29d5ed8fc7958d6a9d1b403310dcc36b2a3f626", - "zh:290bbce092f8836a1db530ac86d933cfea27d52b827639974a81bc48dfba8c34", - "zh:3531f2822c2de3ba837381c4ee4816c5b437fd204c07d659526a04d9154a65e8", - "zh:56d70db4c8c6c0ec1b665380b87726275f4ab3665b4b78ac86dc90e1010c0fe3", - "zh:8251d713c0b2c8c51b6858e51c70d083b484342ff9782a88c39e7eaa966c3da2", - "zh:9a7d1f7207e51382a7dd139dfd5786e7e905edf9bf89bbee4b59ad41365e87be", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:a529c78dfc60063289524690af78794e99a768835b88e27cdfec15bc85439f7c", - "zh:b6da1843355db05c5d412126406fd97db2a6ff9edc166b81c1cea2994535b4eb", - "zh:bfc08cd23b1556b3287d1b28ac7f12c7d459471d97a0592bf2579ea68d11bae7", - "zh:c382088faf05894191636b57861069a21de10a5ff4eb8f7cc122e764ccf7a4a8", - "zh:e27f99f389921314ee428b24990d3a829057ce532b2beb33c69387458722edd9", - "zh:ef11285eedb45ffc3fb2ecdfefa206e64eb2760a87fff15c44dee42de9703436", - "zh:fedc4ebee0d6fe196691127004db5d1ff8bd22e3b667a74026bb92c607589b6c", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.1" - constraints = "~> 2.4" - hashes = [ - "h1:gpp25uNkYJYzJVnkyRr7RIBVfwLs9GSq2HNnFpTRBg0=", - "zh:244b445bf34ddbd167731cc6c6b95bbed231dc4493f8cc34bd6850cfe1f78528", - "zh:3c330bdb626123228a0d1b1daa6c741b4d5d484ab1c7ae5d2f48d4c9885cc5e9", - "zh:5ff5f9b791ddd7557e815449173f2db38d338e674d2d91800ac6e6d808de1d1d", - "zh:70206147104f4bf26ae67d730c995772f85bf23e28c2c2e7612c74f4dae3c46f", - "zh:75029676993accd6bef933c196b2fad51a9ec8a69a847dbbe96ec8ebf7926cdc", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7d48d5999fe1fcdae9295a7c3448ac1541f5a24c474bd82df6d4fa3732483f2b", - "zh:b766b38b027f0f84028244d1c2f990431a37d4fc3ac645962924554016507e77", - "zh:bfc7ad301dada204cf51c59d8bd6a9a87de5fddb42190b4d6ba157d6e08a1f10", - "zh:c902b527702a8c5e2c25a6637d07bbb1690cb6c1e63917a5f6dc460efd18d43f", - "zh:d68ae0e1070cf429c46586bc87580c3ed113f76241da2b6e4f1a8348126b3c46", - "zh:f4903fd89f7c92a346ae9e666c2d0b6884c4474ae109e9b4bd15e7efaa4bfc29", - ] -} diff --git a/terraform-iac/dev/setup/dev-setup.tf b/terraform-iac/dev/setup/dev-setup.tf deleted file mode 100644 index 5f177d12..00000000 --- a/terraform-iac/dev/setup/dev-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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 5c6d0d4c..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 = "5.33.0" - constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 5.33" - hashes = [ - "h1:kPm7PkwHh6tZ74pUj5C/QRPtauxdnzrEG2yhCJla/4o=", - "zh:10bb683f2a9306e881f51a971ad3b2bb654ac94b54945dd63769876a343b5b04", - "zh:3916406db958d5487ea0c2d2320012d1907c29e6d01bf693560fe05e38ee0601", - "zh:3cb54b76b2f9e30620f3281ab7fb20633b1e4584fc84cc4ecd5752546252e86f", - "zh:513bcfd6971482215c5d64725189f875cbcbd260c6d11f0da4d66321efd93a92", - "zh:545a34427ebe7a950056627e7c980c9ba16318bf086d300eb808ffc41c52b7a8", - "zh:5a44b90faf1c8e8269f389c04bfac25ad4766d26360e7f7ac371be12a442981c", - "zh:64e1ef83162f78538dccad8b035577738851395ba774d6919cb21eb465a21e3a", - "zh:7315c70cb6b7f975471ea6129474639a08c58c071afc95a36cfaa41a13ae7fb9", - "zh:9806faae58938d638b757f54414400be998dddb45edfd4a29c85e827111dc93d", - "zh:997fa2e2db242354d9f772fba7eb17bd6d18d28480291dd93f85a18ca0a67ac2", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f9e076b7e9752971f39eead6eda69df1c5e890c82ba2ca95f56974af7adfe79", - "zh:b1d6af047f96de7f97d38b685654f1aed4356d5060b0e696d87d0270f5d49f75", - "zh:bfb0654b6f34398aeffdf907b744af06733d168db610a2c5747263380f817ac7", - "zh:e25203ee8cedccf60bf450950d533d3c172509bda8af97dbc3bc817d2a503c57", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.1" - constraints = "~> 2.4" - hashes = [ - "h1:gpp25uNkYJYzJVnkyRr7RIBVfwLs9GSq2HNnFpTRBg0=", - "zh:244b445bf34ddbd167731cc6c6b95bbed231dc4493f8cc34bd6850cfe1f78528", - "zh:3c330bdb626123228a0d1b1daa6c741b4d5d484ab1c7ae5d2f48d4c9885cc5e9", - "zh:5ff5f9b791ddd7557e815449173f2db38d338e674d2d91800ac6e6d808de1d1d", - "zh:70206147104f4bf26ae67d730c995772f85bf23e28c2c2e7612c74f4dae3c46f", - "zh:75029676993accd6bef933c196b2fad51a9ec8a69a847dbbe96ec8ebf7926cdc", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7d48d5999fe1fcdae9295a7c3448ac1541f5a24c474bd82df6d4fa3732483f2b", - "zh:b766b38b027f0f84028244d1c2f990431a37d4fc3ac645962924554016507e77", - "zh:bfc7ad301dada204cf51c59d8bd6a9a87de5fddb42190b4d6ba157d6e08a1f10", - "zh:c902b527702a8c5e2c25a6637d07bbb1690cb6c1e63917a5f6dc460efd18d43f", - "zh:d68ae0e1070cf429c46586bc87580c3ed113f76241da2b6e4f1a8348126b3c46", - "zh:f4903fd89f7c92a346ae9e666c2d0b6884c4474ae109e9b4bd15e7efaa4bfc29", - ] -} diff --git a/terraform-iac/prd/app/prd-app.tf b/terraform-iac/prd/app/prd-app.tf deleted file mode 100644 index d5926195..00000000 --- a/terraform-iac/prd/app/prd-app.tf +++ /dev/null @@ -1,67 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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/.terraform.lock.hcl b/terraform-iac/prd/setup/.terraform.lock.hcl deleted file mode 100644 index 70fead6f..00000000 --- a/terraform-iac/prd/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 = "5.33.0" - constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 5.33" - hashes = [ - "h1:kPm7PkwHh6tZ74pUj5C/QRPtauxdnzrEG2yhCJla/4o=", - "zh:10bb683f2a9306e881f51a971ad3b2bb654ac94b54945dd63769876a343b5b04", - "zh:3916406db958d5487ea0c2d2320012d1907c29e6d01bf693560fe05e38ee0601", - "zh:3cb54b76b2f9e30620f3281ab7fb20633b1e4584fc84cc4ecd5752546252e86f", - "zh:513bcfd6971482215c5d64725189f875cbcbd260c6d11f0da4d66321efd93a92", - "zh:545a34427ebe7a950056627e7c980c9ba16318bf086d300eb808ffc41c52b7a8", - "zh:5a44b90faf1c8e8269f389c04bfac25ad4766d26360e7f7ac371be12a442981c", - "zh:64e1ef83162f78538dccad8b035577738851395ba774d6919cb21eb465a21e3a", - "zh:7315c70cb6b7f975471ea6129474639a08c58c071afc95a36cfaa41a13ae7fb9", - "zh:9806faae58938d638b757f54414400be998dddb45edfd4a29c85e827111dc93d", - "zh:997fa2e2db242354d9f772fba7eb17bd6d18d28480291dd93f85a18ca0a67ac2", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f9e076b7e9752971f39eead6eda69df1c5e890c82ba2ca95f56974af7adfe79", - "zh:b1d6af047f96de7f97d38b685654f1aed4356d5060b0e696d87d0270f5d49f75", - "zh:bfb0654b6f34398aeffdf907b744af06733d168db610a2c5747263380f817ac7", - "zh:e25203ee8cedccf60bf450950d533d3c172509bda8af97dbc3bc817d2a503c57", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.1" - constraints = "~> 2.4" - hashes = [ - "h1:gpp25uNkYJYzJVnkyRr7RIBVfwLs9GSq2HNnFpTRBg0=", - "zh:244b445bf34ddbd167731cc6c6b95bbed231dc4493f8cc34bd6850cfe1f78528", - "zh:3c330bdb626123228a0d1b1daa6c741b4d5d484ab1c7ae5d2f48d4c9885cc5e9", - "zh:5ff5f9b791ddd7557e815449173f2db38d338e674d2d91800ac6e6d808de1d1d", - "zh:70206147104f4bf26ae67d730c995772f85bf23e28c2c2e7612c74f4dae3c46f", - "zh:75029676993accd6bef933c196b2fad51a9ec8a69a847dbbe96ec8ebf7926cdc", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7d48d5999fe1fcdae9295a7c3448ac1541f5a24c474bd82df6d4fa3732483f2b", - "zh:b766b38b027f0f84028244d1c2f990431a37d4fc3ac645962924554016507e77", - "zh:bfc7ad301dada204cf51c59d8bd6a9a87de5fddb42190b4d6ba157d6e08a1f10", - "zh:c902b527702a8c5e2c25a6637d07bbb1690cb6c1e63917a5f6dc460efd18d43f", - "zh:d68ae0e1070cf429c46586bc87580c3ed113f76241da2b6e4f1a8348126b3c46", - "zh:f4903fd89f7c92a346ae9e666c2d0b6884c4474ae109e9b4bd15e7efaa4bfc29", - ] -} diff --git a/terraform-iac/prd/setup/prd-setup.tf b/terraform-iac/prd/setup/prd-setup.tf deleted file mode 100644 index 3f518c39..00000000 --- a/terraform-iac/prd/setup/prd-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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/cpy/setup/.terraform.lock.hcl b/terraform-iac/setup/.terraform.lock.hcl similarity index 100% rename from terraform-iac/cpy/setup/.terraform.lock.hcl rename to terraform-iac/setup/.terraform.lock.hcl 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 42104f24..125b9136 100644 --- a/terraform-iac/modules/setup/setup.tf +++ b/terraform-iac/setup/setup.tf @@ -1,9 +1,44 @@ +terraform { + required_version = "1.7.0" + 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 5c6d0d4c..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 = "5.33.0" - constraints = ">= 3.69.0, >= 4.0.0, >= 4.2.0, ~> 5.33" - hashes = [ - "h1:kPm7PkwHh6tZ74pUj5C/QRPtauxdnzrEG2yhCJla/4o=", - "zh:10bb683f2a9306e881f51a971ad3b2bb654ac94b54945dd63769876a343b5b04", - "zh:3916406db958d5487ea0c2d2320012d1907c29e6d01bf693560fe05e38ee0601", - "zh:3cb54b76b2f9e30620f3281ab7fb20633b1e4584fc84cc4ecd5752546252e86f", - "zh:513bcfd6971482215c5d64725189f875cbcbd260c6d11f0da4d66321efd93a92", - "zh:545a34427ebe7a950056627e7c980c9ba16318bf086d300eb808ffc41c52b7a8", - "zh:5a44b90faf1c8e8269f389c04bfac25ad4766d26360e7f7ac371be12a442981c", - "zh:64e1ef83162f78538dccad8b035577738851395ba774d6919cb21eb465a21e3a", - "zh:7315c70cb6b7f975471ea6129474639a08c58c071afc95a36cfaa41a13ae7fb9", - "zh:9806faae58938d638b757f54414400be998dddb45edfd4a29c85e827111dc93d", - "zh:997fa2e2db242354d9f772fba7eb17bd6d18d28480291dd93f85a18ca0a67ac2", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f9e076b7e9752971f39eead6eda69df1c5e890c82ba2ca95f56974af7adfe79", - "zh:b1d6af047f96de7f97d38b685654f1aed4356d5060b0e696d87d0270f5d49f75", - "zh:bfb0654b6f34398aeffdf907b744af06733d168db610a2c5747263380f817ac7", - "zh:e25203ee8cedccf60bf450950d533d3c172509bda8af97dbc3bc817d2a503c57", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.1" - constraints = "~> 2.4" - hashes = [ - "h1:gpp25uNkYJYzJVnkyRr7RIBVfwLs9GSq2HNnFpTRBg0=", - "zh:244b445bf34ddbd167731cc6c6b95bbed231dc4493f8cc34bd6850cfe1f78528", - "zh:3c330bdb626123228a0d1b1daa6c741b4d5d484ab1c7ae5d2f48d4c9885cc5e9", - "zh:5ff5f9b791ddd7557e815449173f2db38d338e674d2d91800ac6e6d808de1d1d", - "zh:70206147104f4bf26ae67d730c995772f85bf23e28c2c2e7612c74f4dae3c46f", - "zh:75029676993accd6bef933c196b2fad51a9ec8a69a847dbbe96ec8ebf7926cdc", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7d48d5999fe1fcdae9295a7c3448ac1541f5a24c474bd82df6d4fa3732483f2b", - "zh:b766b38b027f0f84028244d1c2f990431a37d4fc3ac645962924554016507e77", - "zh:bfc7ad301dada204cf51c59d8bd6a9a87de5fddb42190b4d6ba157d6e08a1f10", - "zh:c902b527702a8c5e2c25a6637d07bbb1690cb6c1e63917a5f6dc460efd18d43f", - "zh:d68ae0e1070cf429c46586bc87580c3ed113f76241da2b6e4f1a8348126b3c46", - "zh:f4903fd89f7c92a346ae9e666c2d0b6884c4474ae109e9b4bd15e7efaa4bfc29", - ] -} diff --git a/terraform-iac/stg/app/stg-app.tf b/terraform-iac/stg/app/stg-app.tf deleted file mode 100644 index 7c4cc2ad..00000000 --- a/terraform-iac/stg/app/stg-app.tf +++ /dev/null @@ -1,66 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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 70fead6f..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 = "5.33.0" - constraints = ">= 3.0.0, >= 4.0.0, >= 4.2.0, ~> 5.33" - hashes = [ - "h1:kPm7PkwHh6tZ74pUj5C/QRPtauxdnzrEG2yhCJla/4o=", - "zh:10bb683f2a9306e881f51a971ad3b2bb654ac94b54945dd63769876a343b5b04", - "zh:3916406db958d5487ea0c2d2320012d1907c29e6d01bf693560fe05e38ee0601", - "zh:3cb54b76b2f9e30620f3281ab7fb20633b1e4584fc84cc4ecd5752546252e86f", - "zh:513bcfd6971482215c5d64725189f875cbcbd260c6d11f0da4d66321efd93a92", - "zh:545a34427ebe7a950056627e7c980c9ba16318bf086d300eb808ffc41c52b7a8", - "zh:5a44b90faf1c8e8269f389c04bfac25ad4766d26360e7f7ac371be12a442981c", - "zh:64e1ef83162f78538dccad8b035577738851395ba774d6919cb21eb465a21e3a", - "zh:7315c70cb6b7f975471ea6129474639a08c58c071afc95a36cfaa41a13ae7fb9", - "zh:9806faae58938d638b757f54414400be998dddb45edfd4a29c85e827111dc93d", - "zh:997fa2e2db242354d9f772fba7eb17bd6d18d28480291dd93f85a18ca0a67ac2", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f9e076b7e9752971f39eead6eda69df1c5e890c82ba2ca95f56974af7adfe79", - "zh:b1d6af047f96de7f97d38b685654f1aed4356d5060b0e696d87d0270f5d49f75", - "zh:bfb0654b6f34398aeffdf907b744af06733d168db610a2c5747263380f817ac7", - "zh:e25203ee8cedccf60bf450950d533d3c172509bda8af97dbc3bc817d2a503c57", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.1" - constraints = "~> 2.4" - hashes = [ - "h1:gpp25uNkYJYzJVnkyRr7RIBVfwLs9GSq2HNnFpTRBg0=", - "zh:244b445bf34ddbd167731cc6c6b95bbed231dc4493f8cc34bd6850cfe1f78528", - "zh:3c330bdb626123228a0d1b1daa6c741b4d5d484ab1c7ae5d2f48d4c9885cc5e9", - "zh:5ff5f9b791ddd7557e815449173f2db38d338e674d2d91800ac6e6d808de1d1d", - "zh:70206147104f4bf26ae67d730c995772f85bf23e28c2c2e7612c74f4dae3c46f", - "zh:75029676993accd6bef933c196b2fad51a9ec8a69a847dbbe96ec8ebf7926cdc", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7d48d5999fe1fcdae9295a7c3448ac1541f5a24c474bd82df6d4fa3732483f2b", - "zh:b766b38b027f0f84028244d1c2f990431a37d4fc3ac645962924554016507e77", - "zh:bfc7ad301dada204cf51c59d8bd6a9a87de5fddb42190b4d6ba157d6e08a1f10", - "zh:c902b527702a8c5e2c25a6637d07bbb1690cb6c1e63917a5f6dc460efd18d43f", - "zh:d68ae0e1070cf429c46586bc87580c3ed113f76241da2b6e4f1a8348126b3c46", - "zh:f4903fd89f7c92a346ae9e666c2d0b6884c4474ae109e9b4bd15e7efaa4bfc29", - ] -} diff --git a/terraform-iac/stg/setup/stg-setup.tf b/terraform-iac/stg/setup/stg-setup.tf deleted file mode 100644 index 81bd5a12..00000000 --- a/terraform-iac/stg/setup/stg-setup.tf +++ /dev/null @@ -1,48 +0,0 @@ -terraform { - required_version = "1.7.0" - 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 = "~> 5.33" - } - 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 -}