Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add the region environmental variable to the variable set instead of to each workspace #63

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
marwinbaumannsbp marked this conversation as resolved.
Show resolved Hide resolved
{ 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
Loading