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

fix: read the space id from the plan rather than the state for a variable #776

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

benPearce1
Copy link
Collaborator

fixes #775

before:

# octopusdeploy_variable.string will be updated in-place
  ~ resource "octopusdeploy_variable" "string" {
      + encrypted_value = (known after apply)
        id              = "5a728184-0d52-4039-9897-58a7f6d63791"
      + key_fingerprint = (known after apply)
        name            = "stringvar"
      + space_id        = "Spaces-962"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
octopusdeploy_variable.string: Modifying... [id=5a728184-0d52-4039-9897-58a7f6d63791]
╷
│ Error: update variable failed
│ 
│   with octopusdeploy_variable.string,
│   on main.tf line 31, in resource "octopusdeploy_variable" "string":
│   31: resource "octopusdeploy_variable" "string" {
│ 
│ Octopus API error: Resource is not found or it doesn't exist in the current space context. Please contact your administrator for more information. [] 
╵

after:

Terraform will perform the following actions:

  # octopusdeploy_variable.string will be updated in-place
  ~ resource "octopusdeploy_variable" "string" {
      + encrypted_value = (known after apply)
        id              = "11f2295a-2f3b-428c-9dc8-36cf911088e4"
      + key_fingerprint = (known after apply)
        name            = "stringvar"
      + space_id        = "Spaces-963"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
octopusdeploy_variable.string: Modifying... [id=11f2295a-2f3b-428c-9dc8-36cf911088e4]
octopusdeploy_variable.string: Modifications complete after 0s [id=11f2295a-2f3b-428c-9dc8-36cf911088e4]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Copy link
Collaborator

@HuyPhanNguyen HuyPhanNguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benPearce1 benPearce1 merged commit 5aa239f into main Sep 4, 2024
22 checks passed
@benPearce1 benPearce1 deleted the bp/variable-update-error branch September 4, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating variable during apply can fail if not default space
3 participants