Skip to content

Commit

Permalink
feature: add the region environmental variable to the variable set in…
Browse files Browse the repository at this point in the history
…stead of to each workspace
  • Loading branch information
marwinbaumannsbp committed Oct 28, 2024
1 parent e67587b commit f98ee4b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ locals {
// if workload_boundary_arn, add workload_permissions_boundary_arn = aws_iam_policy.workload_boundary[0].arn
var.permissions_boundaries.workload_boundary != null && var.permissions_boundaries.workload_boundary != null ? { workload_permissions_boundary_arn = aws_iam_policy.workload_boundary[0].arn } : {}
)

clear_text_env_variables = merge(
var.account_variable_set.clear_text_env_variables,
// always add the default region
{ AWS_DEFAULT_REGION = var.tfe_workspace.default_region },
)
}

tfe_workspace = {
Expand Down Expand Up @@ -132,7 +138,7 @@ resource "tfe_variable_set" "account" {
}

resource "tfe_variable" "account_variable_set_clear_text_env_variables" {
for_each = var.account_variable_set.clear_text_env_variables
for_each = local.account_variable_set.clear_text_env_variables

key = each.key
value = each.value
Expand Down Expand Up @@ -196,7 +202,6 @@ module "tfe_workspace" {
policy_arns = var.tfe_workspace.policy_arns
project_id = var.tfe_workspace.project_id
queue_all_runs = var.tfe_workspace.queue_all_runs
region = var.tfe_workspace.default_region
remote_state_consumer_ids = var.tfe_workspace.remote_state_consumer_ids
repository_identifier = var.tfe_workspace.connect_vcs_repo ? var.tfe_workspace.repository_identifier : null
role_name = var.tfe_workspace.role_name
Expand Down Expand Up @@ -248,7 +253,7 @@ module "additional_tfe_workspaces" {
policy_arns = each.value.policy_arns
project_id = each.value.project_id != null ? each.value.project_id : var.tfe_workspace.project_id
queue_all_runs = each.value.queue_all_runs
region = coalesce(each.value.default_region, var.tfe_workspace.default_region)
region = each.value.default_region
remote_state_consumer_ids = each.value.remote_state_consumer_ids
repository_identifier = each.value.connect_vcs_repo != false ? coalesce(each.value.repository_identifier, var.tfe_workspace.repository_identifier) : null
role_name = coalesce(each.value.role_name, "TFEPipeline${replace(title(each.key), "/[_-]/", "")}")
Expand Down

0 comments on commit f98ee4b

Please sign in to comment.