terraform-provider-tfe
terraform-provider-tfe copied to clipboard
error on setting global argument for tfe_variable resource
Terraform Cloud/Enterprise version
Terraform Cloud
Terraform version
Terraform v1.2.7
Terraform Configuration Files
resource "tfe_variable" "channel_name_aws_account_list" {
category = "terraform"
description = "List of channels and aws accounts"
key = "channel_name_aws_account_list"
sensitive = false
global = true ### (Optional) Whether or not the variable set applies to all workspaces in the organization. Defaults to false.
hcl = true
value = <<EOT
{
"aaaa" = "12345",
"bbb" = "67890"
}
EOT
variable_set_id = tfe_variable_set.channel_accounts.id
}
Debug Output
Error: Unsupported argument
An argument named "global" is not expected here.
Expected Behavior
the argument global is listed at https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable_set
It's supposed to set the variable available for all workspaces in the TF organization
Actual Behavior
however when I run Action -> Plan and Apply I get an error "Error: Unsupported argument".
When I manually check off in Terraform Cloud UI the "Apply to all workspaces in this organization" in TF Organization -> Variable sets -> variable set
and run terraform plan again, I get
global : true change to false
which leads me to believe the argument is being set by Terraform Cloud however gets errored out on runs.
Additional Context
Thanks @sbgtvbroadcast ! You're right - we list the attribute in the docs, but I don't see support for it in our code. I've opened an internal issue for this to be addressed.
Hi @sbgtvbroadcast !
Sorry I responded so quickly at first. Rereading what you wrote, I realized I misread what you wrote.
I'll clarify the functionality that we have. A variable_set may be global, and here is an example of that:
resource "tfe_variable_set" "test" {
name = "Global Varset"
description = "Variable set applied to all workspaces."
global = true
organization = tfe_organization.test.name
}
A variable, however, does not support the global flag. A variable can be added to a global variable set like this:
resource "tfe_organization" "test" {
name = "my-org-name"
email = "[email protected]"
}
resource "tfe_variable_set" "test" {
name = "Test Varset"
description = "Some description."
global = false
organization = tfe_organization.test.name
}
resource "tfe_variable" "test-a" {
key = "seperate_variable"
value = "my_value_name"
category = "terraform"
description = "a useful description"
variable_set_id = tfe_variable_set.test.id
}
I hope this clarifies the functionality! I'll close this issue out because it's not an issue - it's how things work.
I stand corrected! Thank you!