From dfdc62f80c2483211187b5eb60a54df6e22dbb0a Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 10 Mar 2023 21:32:56 -0800 Subject: [PATCH] Consolidating locals into one place Also adding -input=false to Makefile --- infra/Makefile | 2 +- infra/ecr.tf | 5 ----- infra/local.tf | 11 +++++++++++ infra/s3.tf | 15 ++++----------- 4 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 infra/local.tf diff --git a/infra/Makefile b/infra/Makefile index c3a6eae..507406e 100644 --- a/infra/Makefile +++ b/infra/Makefile @@ -3,7 +3,7 @@ plan=out.plan SHELL := /bin/bash $(plan): *.tf - source secrets/set-env.sh && terraform plan -out $(plan) + source secrets/set-env.sh && terraform plan -input=false -out $(plan) push: build source secrets/set-env.sh && terraform apply $(plan) diff --git a/infra/ecr.tf b/infra/ecr.tf index 2412110..ee029ea 100644 --- a/infra/ecr.tf +++ b/infra/ecr.tf @@ -1,8 +1,3 @@ -locals { - repos = [ - "reverse-proxy", - ] -} resource "aws_ecr_repository" "this" { for_each = { for index, repo in local.repos: diff --git a/infra/local.tf b/infra/local.tf new file mode 100644 index 0000000..34ce88c --- /dev/null +++ b/infra/local.tf @@ -0,0 +1,11 @@ +locals { + # ECR + repos = [ + "reverse-proxy", + ] + buckets = [ + "shockrah.xyz", + "resume.shockrah.xyz" + ] +} + diff --git a/infra/s3.tf b/infra/s3.tf index a5677ce..0426b21 100644 --- a/infra/s3.tf +++ b/infra/s3.tf @@ -1,20 +1,13 @@ -locals { - static_content_shockrah_xyz = [ - { name = "shockrah-xyz" }, - { name = "resume-shockrah-xyz" } - ] -} - resource "aws_s3_bucket" "static-content" { for_each = { - for idx, record in local.static_content_shockrah_xyz: + for idx, record in local.buckets: idx => record } - bucket = each.value.name + bucket = each.value tags = { - Name = each.value.name - Description = lookup(each.value, "desc", "Static content") + Name = each.value + Description = "Static content" } }