Skip to content

Commit

Permalink
set repo vars resource creation dependency on environments list
Browse files Browse the repository at this point in the history
  • Loading branch information
sj-williams committed Apr 23, 2024
1 parent 0b52bb9 commit 073f0e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -294,23 +294,23 @@ resource "aws_iam_role_policy_attachment" "github_ecr" {

# Actions
resource "github_actions_secret" "ecr_role_to_assume" {
for_each = local.enable_github ? local.github_repos : []
for_each = (length(var.github_environments) == 0 && local.enable_github) ? local.github_repos : []

repository = each.value
secret_name = local.github_variable_names["ECR_ROLE_TO_ASSUME"]
plaintext_value = aws_iam_role.github[0].arn
}

resource "github_actions_variable" "ecr_region" {
for_each = local.enable_github ? local.github_repos : []
for_each = (length(var.github_environments) == 0 && local.enable_github) ? local.github_repos : []

repository = each.value
variable_name = local.github_variable_names["ECR_REGION"]
value = data.aws_region.current.name
}

resource "github_actions_variable" "ecr_repository" {
for_each = local.enable_github ? local.github_repos : []
for_each = (length(var.github_environments) == 0 && local.enable_github) ? local.github_repos : []

repository = each.value
variable_name = local.github_variable_names["ECR_REPOSITORY"]
Expand Down

0 comments on commit 073f0e3

Please sign in to comment.