From 7c33a0ca9ac7b064431c04960147a1a5abb7f339 Mon Sep 17 00:00:00 2001 From: Mike McGirr Date: Fri, 18 Oct 2019 17:20:08 -0700 Subject: [PATCH] tf-cloud-credential: switch to datasource and fix variable --- modules/tf-cloud-credential/data.tf | 4 ++-- modules/tf-cloud-credential/main.tf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/tf-cloud-credential/data.tf b/modules/tf-cloud-credential/data.tf index 76e35aa4..0c40b55b 100644 --- a/modules/tf-cloud-credential/data.tf +++ b/modules/tf-cloud-credential/data.tf @@ -1,4 +1,4 @@ -resource "tfe_workspace" "workspace" { - name = var.workspace_name_prefix +data "tfe_workspace" "workspace" { + name = var.name_prefix organization = var.organization } diff --git a/modules/tf-cloud-credential/main.tf b/modules/tf-cloud-credential/main.tf index 4a234e10..e77d0367 100644 --- a/modules/tf-cloud-credential/main.tf +++ b/modules/tf-cloud-credential/main.tf @@ -1,5 +1,5 @@ resource "tfe_variable" "workspace_aws_access_key_id" { - workspace_id = tfe_workspace.workspace.id + workspace_id = data.tfe_workspace.workspace.id key = "AWS_ACCESS_KEY_ID" value = var.iam_access_key.id category = "env" @@ -7,7 +7,7 @@ resource "tfe_variable" "workspace_aws_access_key_id" { } resource "tfe_variable" "workspace_aws_secret_access_key_id" { - workspace_id = tfe_workspace.workspace.id + workspace_id = data.tfe_workspace.workspace.id key = "AWS_SECRET_ACCESS_KEY" value = var.iam_access_key.secret category = "env" @@ -15,7 +15,7 @@ resource "tfe_variable" "workspace_aws_secret_access_key_id" { } resource "tfe_variable" "workspace_aws_default_region" { - workspace_id = tfe_workspace.workspace.id + workspace_id = data.tfe_workspace.workspace.id key = "AWS_DEFAULT_REGION" value = var.region category = "env"