terraform-provider-octopusdeploy icon indicating copy to clipboard operation
terraform-provider-octopusdeploy copied to clipboard

octopusdeploy_variable resource is showing an unexpected update when reapplying

Open danielfischeroctopus opened this issue 2 years ago • 1 comments

Describe the bug

The octopusdeploy_variable resource is exhibiting some unexpected behaviour when creating and updating prompted variables.

Steps to reproduce

  1. Create a new prompted variable via Terraform. Here's what I used:
resource "octopusdeploy_variable" "Example" {
  owner_id    = "Projects-ID"
  type        = "String"
  name        = "Example"
  description = "Example var description"
  value       = "ABC"
  is_editable = false
  prompt {
    label       = "Prompted Variable Label"
    is_required = false
    display_settings {
      control_type = "Checkbox"
    }
  }
}
  1. Apply, then check Octopus UI to see the variable. Octopus created three duplicate ABC values for the variable in initial testing, but I haven't been able to reproduce that behaviour again.
  2. Rerun the apply and Terraform will try to change the is_editable value. Each subsequent rerun returned the same output as below.
terraform apply
octopusdeploy_project_group.TestProject: Refreshing state... [id=ProjectGroups-1515]
octopusdeploy_environment.newEnvironment: Refreshing state... [id=Environments-1881]
octopusdeploy_variable.Example: Refreshing state... [id=a3d916a6-4dcf-4c3f-a5e4-59c721dd821b]
octopusdeploy_lifecycle.newLifecycle: Refreshing state... [id=Lifecycles-1637]
octopusdeploy_project.TestProject: Refreshing state... [id=Projects-3110]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # octopusdeploy_variable.Example will be updated in-place
  ~ resource "octopusdeploy_variable" "Example" {
        id           = "a3d916a6-4dcf-4c3f-a5e4-59c721dd821b"
      ~ is_editable  = true -> false
        name         = "Example"
        # (5 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Expected behavior

The is_editable value has not changed between applies, so Octopus shouldn't be attempting to edit it.

Logs and other supporting information

Internal source: https://octopus.zendesk.com/agent/tickets/108699

Environment and versions:

  • Octopus Server Version: 2023.1.8700-hotfix.9526 (Current cloud version when reproduced)
  • Terraform Version: 1.3.9
  • Octopus Terraform Provider Version: 0.10.3

danielfischeroctopus avatar Feb 22 '23 02:02 danielfischeroctopus

i've seen this as well, i noticed that when the is_editable is set to true it actually does not apply to the octopus variable in octo, as its still editable, at least within a standard library set.

garkenxian avatar Oct 24 '23 14:10 garkenxian