Skip to content

Commit

Permalink
Properly remove TFE variables already defined in variable sets, take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Jan 11, 2024
1 parent 0913357 commit 09e12dc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 41 deletions.
38 changes: 0 additions & 38 deletions tf-modules/environment_workspace/tfe.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,41 +69,3 @@ resource "tfe_variable" "gcp_project_id" {
key = "gcp_project_id"
value = google_project.main.project_id
}

// TODO: Remove when https://support.hashicorp.com/hc/en-us/requests/78185 is fixed
resource "tfe_variable" "shared_infra_gcp_project_id" {
workspace_id = tfe_workspace.main.id

category = "terraform"
key = "shared_infra_gcp_project_id"
value = var.shared_infra_gcp_project_id
}

// TODO: Remove when https://support.hashicorp.com/hc/en-us/requests/78185 is fixed
resource "tfe_variable" "mongodb_atlas_org_id" {
workspace_id = tfe_workspace.main.id

category = "terraform"
key = "mongodb_atlas_org_id"
value = var.mongodb_atlas_org_id
}

// TODO: Remove when https://support.hashicorp.com/hc/en-us/requests/78185 is fixed
resource "tfe_variable" "env_mongodb_atlas_public_key" {
workspace_id = tfe_workspace.main.id

category = "env"
key = "MONGODB_ATLAS_PUBLIC_KEY"
value = var.env_mongodb_atlas_public_key
sensitive = false
}

// TODO: Remove when https://support.hashicorp.com/hc/en-us/requests/78185 is fixed
resource "tfe_variable" "env_mongodb_atlas_private_key" {
workspace_id = tfe_workspace.main.id

category = "env"
key = "MONGODB_ATLAS_PRIVATE_KEY"
value = var.env_mongodb_atlas_private_key
sensitive = true
}
4 changes: 1 addition & 3 deletions tf-modules/environment_workspace/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ variable "name" {
description = "Environment name"
}

variable "shared_infra_gcp_project_id" {
default = null // Take from variable set
}
variable "shared_infra_gcp_project_id" {}
variable "gcp_parent_folder" {}
variable "gcp_billing_account" {}

Expand Down
2 changes: 2 additions & 0 deletions tf-workspace/environments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module "env_frankfurt" {
gcp_parent_folder = var.gcp_parent_folder
gcp_billing_account = var.gcp_billing_account

shared_infra_gcp_project_id = data.google_project.main.project_id

depends_on = [google_project_service.iam]
}

Expand Down

0 comments on commit 09e12dc

Please sign in to comment.