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

Chore!: fix lvs datasource unexpected changes and resource Known After Apply differences. #739

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

IsaacCalligeros95
Copy link
Collaborator

@IsaacCalligeros95 IsaacCalligeros95 commented Aug 15, 2024

This fixes the following two issues found in testing:

Fixes [] => null on templates and "" -> null on display settings.

Changes to Outputs:
  ~ lvs  = {
      ~ id                    = "Library Variables Sets 2024-08-15 02:14:22.495669 +0000 UTC" -> "Library Variables Sets 2024-08-15 02:23:27.676669 +0000 UTC"
      ~ library_variable_sets = [
          ~ {
                id              = "LibraryVariableSets-81"
                name            = "Another Variable Set"
              ~ template        = [] -> null
                # (4 unchanged attributes hidden)
            },
        ]
        # (6 unchanged attributes hidden)
    }
  ~ sms  = {
      ~ id                    = "Library Variables Sets 2024-08-15 02:14:22.498898 +0000 UTC" -> "Library Variables Sets 2024-08-15 02:23:27.675886 +0000 UTC"
      ~ library_variable_sets = [
          ~ {
                id              = "LibraryVariableSets-82"
                name            = "Hello"
              ~ template        = [] -> null
                # (4 unchanged attributes hidden)
            },
        ]
        # (6 unchanged attributes hidden)
    }

Unexpected changes, only display_settings has been changed.

  # octopusdeploy_library_variable_set.newvariableset will be updated in-place
  ~ resource "octopusdeploy_library_variable_set" "newvariableset" {
      ~ id              = "LibraryVariableSets-85" -> (known after apply)
        name            = "Library Variable Set test (OK to Delete)"
      ~ space_id        = "Spaces-1" -> (known after apply)
      ~ template_ids    = {
          - "AnotherTemplate" = "234c7e65-a1eb-4d77-94e3-eb231e2978ac"
          - "TheTemplate"     = "687ed66c-ea94-42ce-9348-753112a3c730"
        } -> (known after apply)
      ~ variable_set_id = "variableset-LibraryVariableSets-85" -> (known after apply)
        # (1 unchanged attribute hidden)

      ~ template {
          ~ display_settings = {
              ~ "Octopus.ControlType" = "Sensitive" -> "SingleLineText"
            }
            id               = "687ed66c-ea94-42ce-9348-753112a3c730"
            name             = "TheTemplate"
            # (3 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

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

@@ -145,6 +147,9 @@ func GetIdResourceSchema() resourceSchema.Attribute {
Description: "The unique ID for this resource.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.String{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These changes match the util.schema class. It'd be nice to fully consolidate these two files now that things have settled.

Copy link
Contributor

@hnrkndrssn hnrkndrssn left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@IsaacCalligeros95
Copy link
Collaborator Author

IsaacCalligeros95 commented Aug 15, 2024

@hnrkndrssn I had to remove the UseStateForUnknown from Template Ids change so that still shows Known After Apply. This is a change of behaviour from the previous provider but required by the framework.

@IsaacCalligeros95 IsaacCalligeros95 enabled auto-merge (squash) August 15, 2024 04:48
@IsaacCalligeros95 IsaacCalligeros95 merged commit d7fc15c into main Aug 15, 2024
22 checks passed
@IsaacCalligeros95 IsaacCalligeros95 deleted the isaac/lvs-datasource-template-fix branch August 15, 2024 04:51
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.

2 participants