From 26724abef985c1669d223ff4e12e43cfd35c529a Mon Sep 17 00:00:00 2001 From: Gavin Williams <109519102+fatmcgav-depop@users.noreply.github.com> Date: Wed, 10 Aug 2022 19:34:48 +0100 Subject: [PATCH] fix: Disable endpoint creation when setting `create_proxy = false` (#12) Co-authored-by: Bryant Biggs --- .pre-commit-config.yaml | 4 ++-- examples/mysql_iam_cluster/main.tf | 2 +- examples/mysql_iam_instance/main.tf | 2 +- examples/postgresql_iam_cluster/main.tf | 2 +- examples/postgresql_iam_instance/main.tf | 2 +- main.tf | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a0925b0..727e21c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.68.1 + rev: v1.74.1 hooks: - id: terraform_fmt - id: terraform_validate @@ -23,7 +23,7 @@ repos: - '--args=--only=terraform_standard_module_structure' - '--args=--only=terraform_workspace_remote' - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.3.0 hooks: - id: check-merge-conflict - id: end-of-file-fixer diff --git a/examples/mysql_iam_cluster/main.tf b/examples/mysql_iam_cluster/main.tf index 4a45909..ef274d6 100644 --- a/examples/mysql_iam_cluster/main.tf +++ b/examples/mysql_iam_cluster/main.tf @@ -47,7 +47,7 @@ module "rds_proxy" { } secrets = { - "${local.db_username}" = { + (local.db_username) = { description = aws_secretsmanager_secret.superuser.description arn = aws_secretsmanager_secret.superuser.arn kms_key_id = aws_secretsmanager_secret.superuser.kms_key_id diff --git a/examples/mysql_iam_instance/main.tf b/examples/mysql_iam_instance/main.tf index 77aef11..53348a4 100644 --- a/examples/mysql_iam_instance/main.tf +++ b/examples/mysql_iam_instance/main.tf @@ -47,7 +47,7 @@ module "rds_proxy" { } secrets = { - "${local.db_username}" = { + (local.db_username) = { description = aws_secretsmanager_secret.superuser.description arn = aws_secretsmanager_secret.superuser.arn kms_key_id = aws_secretsmanager_secret.superuser.kms_key_id diff --git a/examples/postgresql_iam_cluster/main.tf b/examples/postgresql_iam_cluster/main.tf index 9847c5e..26f85f1 100644 --- a/examples/postgresql_iam_cluster/main.tf +++ b/examples/postgresql_iam_cluster/main.tf @@ -47,7 +47,7 @@ module "rds_proxy" { } secrets = { - "${local.db_username}" = { + (local.db_username) = { description = aws_secretsmanager_secret.superuser.description arn = aws_secretsmanager_secret.superuser.arn kms_key_id = aws_secretsmanager_secret.superuser.kms_key_id diff --git a/examples/postgresql_iam_instance/main.tf b/examples/postgresql_iam_instance/main.tf index 4f3014e..7dc47c9 100644 --- a/examples/postgresql_iam_instance/main.tf +++ b/examples/postgresql_iam_instance/main.tf @@ -47,7 +47,7 @@ module "rds_proxy" { } secrets = { - "${local.db_username}" = { + (local.db_username) = { description = aws_secretsmanager_secret.superuser.description arn = aws_secretsmanager_secret.superuser.arn kms_key_id = aws_secretsmanager_secret.superuser.kms_key_id diff --git a/main.tf b/main.tf index 656d23a..fb4d0f0 100644 --- a/main.tf +++ b/main.tf @@ -68,7 +68,7 @@ resource "aws_db_proxy_target" "db_cluster" { } resource "aws_db_proxy_endpoint" "this" { - for_each = var.db_proxy_endpoints + for_each = { for k, v in var.db_proxy_endpoints : k => v if var.create_proxy } db_proxy_name = aws_db_proxy.this[0].name db_proxy_endpoint_name = each.value.name