Skip to content

Commit

Permalink
move template only logic to the template only bin
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySteiner committed Jan 17, 2024
1 parent a6f7a0e commit 02da994
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion infra/app/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ locals {

service_name = "${local.prefix}${module.app_config.app_name}-${var.environment_name}"

is_temporary = startswith(terraform.workspace, "t-") || startswith(module.project_config.project_name, "plt-tst-act-")
is_temporary = startswith(terraform.workspace, "t-")

# Include project name in bucket name since buckets need to be globally unique across AWS
bucket_name = "${local.prefix}${module.project_config.project_name}-${module.app_config.app_name}-${var.environment_name}"
Expand Down
3 changes: 2 additions & 1 deletion template-only-bin/destroy-app-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ BACKEND_CONFIG_FILE="dev.s3.tfbackend"

sed -i.bak 's/force_destroy = false/force_destroy = true/g' infra/modules/service/access-logs.tf
sed -i.bak 's/force_destroy = false/force_destroy = true/g' infra/modules/storage/main.tf
sed -i.bak 's/enable_deletion_protection = var.is_temp_environment/enable_deletion_protection = false/g' infra/modules/service/load-balancer.tf

cd infra/app/service

terraform init -reconfigure -backend-config=$BACKEND_CONFIG_FILE

terraform apply -auto-approve -target="module.service.aws_s3_bucket.access_logs" -var="environment_name=dev"
terraform apply -auto-approve -target="module.service.aws_s3_bucket.access_logs" -target="module.service.aws_lb.alb" -var="environment_name=dev"

terraform destroy -auto-approve -var="environment_name=dev"

0 comments on commit 02da994

Please sign in to comment.