Skip to content

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

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

Open
jeliker1 opened this issue Mar 15, 2025 · 1 comment
Labels
bug In-Progress Terraform Team is working on the reproduce & fix

Comments

@jeliker1
Copy link

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

@jeliker1 jeliker1 added the bug label Mar 15, 2025
@tf-oci-pub tf-oci-pub added the In-Progress Terraform Team is working on the reproduce & fix label Mar 15, 2025
@tf-oci-pub
Copy link
Member

Thank you for reporting the issue. We have raised an internal ticket to track this. Our service engineers will get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug In-Progress Terraform Team is working on the reproduce & fix
Projects
None yet
Development

No branches or pull requests

2 participants