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

Creating the same variable with a different scope doesn't receive an ID #797

Open
SanderKnape opened this issue Oct 15, 2024 · 0 comments
Open
Labels
area/variables kind/bug Something isn't working

Comments

@SanderKnape
Copy link

SanderKnape commented Oct 15, 2024

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 #785.

@domenicsim1 domenicsim1 added kind/bug Something isn't working area/variables labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/variables kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants