Consolidating locals into one place

Also adding -input=false to Makefile
This commit is contained in:
shockrah 2023-03-10 21:32:56 -08:00
parent 17d3f66073
commit dfdc62f80c
4 changed files with 16 additions and 17 deletions

View File

@ -3,7 +3,7 @@ plan=out.plan
SHELL := /bin/bash SHELL := /bin/bash
$(plan): *.tf $(plan): *.tf
source secrets/set-env.sh && terraform plan -out $(plan) source secrets/set-env.sh && terraform plan -input=false -out $(plan)
push: build push: build
source secrets/set-env.sh && terraform apply $(plan) source secrets/set-env.sh && terraform apply $(plan)

View File

@ -1,8 +1,3 @@
locals {
repos = [
"reverse-proxy",
]
}
resource "aws_ecr_repository" "this" { resource "aws_ecr_repository" "this" {
for_each = { for_each = {
for index, repo in local.repos: for index, repo in local.repos:

11
infra/local.tf Normal file
View File

@ -0,0 +1,11 @@
locals {
# ECR
repos = [
"reverse-proxy",
]
buckets = [
"shockrah.xyz",
"resume.shockrah.xyz"
]
}

View File

@ -1,20 +1,13 @@
locals {
static_content_shockrah_xyz = [
{ name = "shockrah-xyz" },
{ name = "resume-shockrah-xyz" }
]
}
resource "aws_s3_bucket" "static-content" { resource "aws_s3_bucket" "static-content" {
for_each = { for_each = {
for idx, record in local.static_content_shockrah_xyz: for idx, record in local.buckets:
idx => record idx => record
} }
bucket = each.value.name bucket = each.value
tags = { tags = {
Name = each.value.name Name = each.value
Description = lookup(each.value, "desc", "Static content") Description = "Static content"
} }
} }