terraform-provider-octopusdeploy
terraform-provider-octopusdeploy copied to clipboard
Creating the same variable with a different scope doesn't receive an ID
Describe the bug When creating two variables with the same name on a project, and they both have a different scope, the variable that is created last doesn't get its ID stored in state. This results in warnings in subsequent plans/applies, and that variable can't be edited or removed.
Steps to reproduce The following two variables both have the same name but a different scope.
resource "octopusdeploy_variable" "var1" {
owner_id = var.project_id
type = "String"
name = "TestingFromTF"
value = "test1"
scope {
environments = [
var.environment1
]
}
}
resource "octopusdeploy_variable" "var2" {
owner_id = var.project_id
type = "String"
name = "TestingFromTF"
value = "test2"
scope {
environments = [
var.environment2
]
}
}
When first var1 is applied, then var2, a terraform state show 'octopusdeploy_variable.var2 will show that no ID is set on this second variable.
Expected behavior The variable should have an ID.
Errors
When trying to remove the variable with no ID, the following errors is shown:
VariableService: invalid parameter, variableID
Error: unable to delete variable
Environment and versions:
- OS: OSX
- Octopus Server Version: v2024.4 (Build 4121)
- Terraform Version: 19.7
- Octopus Terraform Provider Version: 0.32.0
Additional context This looks like a follow up from https://github.com/OctopusDeployLabs/terraform-provider-octopusdeploy/issues/785.