diff --git a/deployments/aws/ecs/iam.tf b/deployments/aws/ecs/iam.tf index f5a53d7cc..6435dd591 100644 --- a/deployments/aws/ecs/iam.tf +++ b/deployments/aws/ecs/iam.tf @@ -60,6 +60,7 @@ resource "aws_iam_policy" "secrets_access" { } resource "aws_iam_policy" "task_secrets_access" { + count = var.disable_temporal_autosetup ? 0 : 1 name = "TracecatTaskSecretsAccessPolicy" description = "Policy for accessing Tracecat secrets at runtime" policy = jsonencode({ @@ -158,7 +159,8 @@ resource "aws_iam_role_policy" "api_worker_task_db_access" { }) } resource "aws_iam_role_policy_attachment" "api_worker_task_secrets" { - policy_arn = aws_iam_policy.task_secrets_access.arn + count = var.disable_temporal_autosetup ? 0 : 1 + policy_arn = aws_iam_policy.task_secrets_access[0].arn role = aws_iam_role.api_worker_task.name } @@ -291,10 +293,10 @@ resource "aws_iam_policy" "temporal_ui_secrets_access" { { Effect = "Allow" Action = ["secretsmanager:GetSecretValue"] - Resource = [ + Resource = compact([ var.temporal_auth_client_id_arn, var.temporal_auth_client_secret_arn - ] + ]) } ] }) diff --git a/deployments/aws/variables.tf b/deployments/aws/variables.tf index a0ebf98bf..79c315254 100644 --- a/deployments/aws/variables.tf +++ b/deployments/aws/variables.tf @@ -117,7 +117,7 @@ variable "TFC_CONFIGURATION_VERSION_GIT_COMMIT_SHA" { variable "disable_temporal_ui" { type = bool description = "Whether to disable the Temporal UI service in the deployment" - default = false + default = true } variable "disable_temporal_autosetup" {