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

[BUG] list order not consistent in containerregistry_ip_restrictions #636

Open
mxm-tr opened this issue Apr 26, 2024 · 3 comments · May be fixed by #645
Open

[BUG] list order not consistent in containerregistry_ip_restrictions #636

mxm-tr opened this issue Apr 26, 2024 · 3 comments · May be fixed by #645

Comments

@mxm-tr
Copy link
Contributor

mxm-tr commented Apr 26, 2024

Describe the bug

When applying the same container registry configuration multiple times, the ip_restrictions list is not consistent.
This causes the Managed Registries to be recreated at each apply operation.

Terraform Version

OpenTofu, but other clients should have the same issue.

OVH Terraform Provider Version

Latest version

Affected Resource(s)

  • cloud_project_containerregistry_ip_restrictions_registry
  • cloud_project_containerregistry_ip_restrictions_management

Terraform Configuration Files

Any managed registry object with multiple ip_restrictions:

  ip_restrictions = [
    { 
      ip_block = "xxx.xxx.xxx.xxx/xx"
      description = "xxxxxxx"
    },
    { 
      ip_block = "xxx.xxx.xxx.xxx/xx"
      description = "xxxxxxx"
    }
]

Expected Behavior

When applying a the same hcl configuration file multiple times, no change should be triggered.

Actual Behavior

When applying a the same hcl configuration file multiple times, changes were triggered.

Steps to Reproduce

  1. Create a registry with multiple entries in ip_restrictions
  2. Run terraform apply multiple times without any change in the hcl definition.

Additional context

A workaround is to order the items in the hcl file directly:

ip_restrictions= toset([
    {
      "description" : "XXXXXX"
      ip_block = "nnn.nnn.nnn.nnn/nn",
    },
    {
      "description" : "XXXXXX"
      ip_block = "nnn.nnn.nnn.nnn/nn",
    }
])
@amstuta
Copy link
Contributor

amstuta commented Apr 26, 2024

Hi @mxm-tr, this is indeed a bug and I think ip_restrictions should be a TypeSet instead of a TypeList, wdyt ?

@mxm-tr
Copy link
Contributor Author

mxm-tr commented Apr 26, 2024

Hi, yes this could work thanks! I can create a PR next week if you want

@amstuta
Copy link
Contributor

amstuta commented Apr 29, 2024

Yes that would be perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants