Skip to content

oci_os_management_hub_software_source triggers update on every apply because vendor_software_sources are arbitrarily reordered #2327

Open
@jeliker1

Description

@jeliker1

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version and Provider Version

Terraform v1.7.4
on darwin_arm64

  • provider registry.terraform.io/oracle/oci v6.30.0

Affected Resource(s)

affected_resources = oci_os_management_hub_software_source
affected_resources = terraform

Terraform Configuration Files

locals {
    sources = [
        {
            display_name = "ol7_developer-x86_64"
            id           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuya2oldstctrtrwegmewrinqjnroug2vomfmfcvxz3du7eq"
        },
        {
             display_name = "ol7_latest-x86_64"
             id           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuyaljnwf2gxpqj22lbdqj6f2npabfpxkz7cszrhf5odtooa"
        },
        {
            display_name = "ol7_addons-x86_64"
            id           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuya2brfeiwqun6jmim4hpt7xo2wxu4sfixp6nowjxg4ormq"
        }
    ]
}

resource "oci_os_management_hub_software_source" "test_software_source" {
    #Required
    compartment_id = var.compartment_id
    software_source_type = "CUSTOM"

    dynamic "vendor_software_sources" {
        for_each = local.sources
        iterator = src
        content {
            display_name = src.display_name
            id           = src.id
        }
    }
}

Debug Output

First build is fine. Subsequent apply says this:

  # oci_os_management_hub_software_source.test_software_source will be updated in-place
  ~ resource "oci_os_management_hub_software_source" ".test_software_source" {

        id                           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaavj6cqkqahvlrlsjnsxjosk77ygvvkdklxcq4rkfsdhrqemp72z2q"

      ~ vendor_software_sources {
          ~ display_name = "ol7_latest-x86_64" -> "ol7_developer-x86_64"
          ~ id           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuyaljnwf2gxpqj22lbdqj6f2npabfpxkz7cszrhf5odtooa" -> "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuya2oldstctrtrwegmewrinqjnroug2vomfmfcvxz3du7eq"
        }
      ~ vendor_software_sources {
          ~ display_name = "ol7_addons-x86_64" -> "ol7_latest-x86_64"
          ~ id           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuya2brfeiwqun6jmim4hpt7xo2wxu4sfixp6nowjxg4ormq" -> "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuyaljnwf2gxpqj22lbdqj6f2npabfpxkz7cszrhf5odtooa" 
        }
      ~ vendor_software_sources {
          ~ display_name = "ol7_developer-x86_64" -> "ol7_addons-x86_64"
          ~ id           = "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuya2oldstctrtrwegmewrinqjnroug2vomfmfcvxz3du7eq" -> "ocid1.osmhsoftwaresource.oc1.iad.amaaaaaa2nbozuya2brfeiwqun6jmim4hpt7xo2wxu4sfixp6nowjxg4ormq"
        }
    }

Every time I apply it tries to rebuild. I can rearrange my local.sources list and avoid the error but then if I use the same list to build another source they will be in a new, unbreakable order! I've tried removing sources manually then adding back one by one and all fails. I've tried to uncover the mysterious driver behind the sort order and have been unsuccessful (checking repo_id, display_name, id, time_created, etc. but can't find an obvious sort field). Help!

Note that if I create the same source in another region using the same vendor sources (i.e. same display_name, same repo_id though id is different for different region) then it wants them in a different order still! I can't win. Did I mention "HELP!"

Panic Output

Expected Behavior

I expect the vendor_software_sources provided when updating a custom software source to not trigger an update if nothing changes except the order of the sources.

Actual Behavior

When a custom software source is updated, an update is triggered even if nothing changes about the input variables because the order of vendor_software_sources is unpredictable.

Steps to Reproduce

  1. terraform apply and not successful source is created.
  2. Change nothing then terraform apply and note the prompt to update based on the arbitrary re-ordering of the supplied vendor_software_sources

Important Factoids

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-ProgressTerraform Team is working on the reproduce & fixbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions