Skip to content

Conversation

@shemau
Copy link
Collaborator

@shemau shemau commented Aug 6, 2025

Description

Support for restapi version 2.0.0 and greater. Retain support for version 1.20.0+.

Notes:

  • The two submodules that consume restapi change max version to < 3.0.0
  • The one example is pinned to the minimum supported restapi version (1.20.0). This serves two purposes, firstly it provides ongoing cover at the lowest supported level. Secondly it prevents the upgrade test from failing idepempotency, where restapi resources updates are changed.
  • The one DA is pinned to maximum. It seems appropriate that the DA is using latest restapi as well as latest IBM provider.
  • The tests set Region. This avoids running the script that scans all zones for least VPCs. The tests do not use the region from the automated picker, they are coded to use a different random picker process anyway.

Considerations:

  • There is no upgrade test in schematics.
  • There is an mismatch between existing resources (lowest providers) and the test that uses them (DA at latest providers).

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Upgrading to this release, or upgrading the restapi provider with this release or later may result in an update in place showing changes to the restapi data and/or id_attribute and/or ignore_all_server_changes properties when using the storage or traffic quota sub module.

 Terraform used the selected providers to generate the following execution
 plan. Resource actions are indicated with the following symbols:
   ~ update in-place
 
 Terraform will perform the following actions:
 
   # module.set_quota.restapi_object.container_registry_storage_quota[0] will be updated in-place
   ~ resource "restapi_object" "container_registry_storage_quota" {
       ~ data                      = (sensitive value)
         id                        = "storage"
       + id_attribute              = "storage_megabytes"
       + ignore_all_server_changes = false
         # (14 unchanged attributes hidden)
     }
 
   # module.set_quota.restapi_object.container_registry_traffic_quota[0] will be updated in-place
   ~ resource "restapi_object" "container_registry_traffic_quota" {
       ~ data                      = (sensitive value)
         id                        = "traffic"
       + id_attribute              = "traffic_megabytes"
       + ignore_all_server_changes = false
         # (14 unchanged attributes hidden)
     }
 
 Plan: 0 to add, 2 to change, 0 to destroy.

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@shemau
Copy link
Collaborator Author

shemau commented Aug 6, 2025

/run pipeline

@shemau
Copy link
Collaborator Author

shemau commented Aug 8, 2025

/run pipeline

@shemau
Copy link
Collaborator Author

shemau commented Aug 8, 2025

The following changes MAY be reported by the module or the DA. This changes MAY be shown when upgrading terraform-ibm-container-registry, or MAY be shown in later apply where the consumer changes version of the restapi provider.

Terraform will perform the following actions:

  # module.set_quota.restapi_object.container_registry_storage_quota[0] will be updated in-place
  ~ resource "restapi_object" "container_registry_storage_quota" {
      ~ data                      = jsonencode(
          ~ {
              - limit             = {
                  - storage_bytes = 523239424
                  - store         = 523239424
                  - traffic       = 5367660544
                  - traffic_bytes = 5367660544
                }
              ~ storage_megabytes = null -> 499
              - usage             = {
                  - store   = 0
                  - traffic = 0
                }
            }
        )
        id                        = "storage"
      + ignore_all_server_changes = false
        # (14 unchanged attributes hidden)
    }

  # module.set_quota.restapi_object.container_registry_traffic_quota[0] will be updated in-place
  ~ resource "restapi_object" "container_registry_traffic_quota" {
      ~ data                      = jsonencode(
          ~ {
              - limit             = {
                  - storage_bytes = 523239424
                  - store         = 523239424
                  - traffic       = 5367660544
                  - traffic_bytes = 5367660544
                }
              ~ traffic_megabytes = null -> 5119
              - usage             = {
                  - store   = 0
                  - traffic = 0
                }
            }
        )
        id                        = "traffic"
      + ignore_all_server_changes = false
        # (14 unchanged attributes hidden)
    }

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

The data block in restapi v2.0.1 contains the input (as well as the outputs). No changes, just a refresh of the state file to include the input.
The ignore_all_server_changes was previously unset (not present in v1.20.0) and now defaults to false (same behaviour as v1.20.0) which is the default value of the new feature.

@shemau
Copy link
Collaborator Author

shemau commented Aug 8, 2025

/run pipeline

@daniel-butler-irl
Copy link
Contributor

@ocofaigh I guess its fine if the above happens in a fix release?

@shemau
Copy link
Collaborator Author

shemau commented Aug 8, 2025

It looks like there are some update in place warnings from the existing resources test as well. I will complete additional diagnostics next week.

@shemau shemau mentioned this pull request Aug 11, 2025
1 task
@shemau
Copy link
Collaborator Author

shemau commented Aug 19, 2025

The upgrade test still produces

TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: Terraform used the selected providers to generate the following execution
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: plan. Resource actions are indicated with the following symbols:
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:   ~ update in-place
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: 
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: Terraform will perform the following actions:
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: 
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:   # module.set_quota.restapi_object.container_registry_storage_quota[0] will be updated in-place
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:   ~ resource "restapi_object" "container_registry_storage_quota" {
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:       ~ data                      = (sensitive value)
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:         id                        = "storage"
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:       + id_attribute              = "storage_megabytes"
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:       + ignore_all_server_changes = false
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:         # (14 unchanged attributes hidden)
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:     }
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: 
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:   # module.set_quota.restapi_object.container_registry_traffic_quota[0] will be updated in-place
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:   ~ resource "restapi_object" "container_registry_traffic_quota" {
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:       ~ data                      = (sensitive value)
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:         id                        = "traffic"
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:       + id_attribute              = "traffic_megabytes"
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:       + ignore_all_server_changes = false
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:         # (14 unchanged attributes hidden)
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206:     }
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: 
TestRunUpgradeExample 2025-08-19T16:54:11+01:00 command.go:206: Plan: 0 to add, 2 to change, 0 to destroy.

@shemau
Copy link
Collaborator Author

shemau commented Aug 19, 2025

/run pipeline

Copy link
Contributor

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

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

I would update the constraints to only support v2.x of the restapi provider, not v1 and v2, as they require different syntax to consume

@shemau
Copy link
Collaborator Author

shemau commented Oct 23, 2025

Supporting 1.20 and 2.0 may not be an issue, it is not so much a case of different formats, as 2.0.1 requiring a previously optional field to avoid showing changes. If it seems advantageous for any reason to move to only version 2.0, then 1.x can be dropped.

@shemau
Copy link
Collaborator Author

shemau commented Oct 24, 2025

/run pipeline

@shemau
Copy link
Collaborator Author

shemau commented Oct 27, 2025

In order to avoid idempotency issues, it is going to be necessary to use the ignore_all_server_updates flag from 2.0.1.

Thus support for 1.x will be dropped and only >= 2.0.1 provider will be supported.

The upgrade tests have been re-run

TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: Terraform used the selected providers to generate the following execution
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: plan. Resource actions are indicated with the following symbols:
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:   ~ update in-place
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: 
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: Terraform will perform the following actions:
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: 
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:   # module.set_quota.restapi_object.container_registry_storage_quota[0] will be updated in-place
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:   ~ resource "restapi_object" "container_registry_storage_quota" {
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:       ~ data                      = (sensitive value)
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:         id                        = "storage"
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:       + id_attribute              = "storage_megabytes"
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:       + ignore_all_server_changes = true
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:         # (14 unchanged attributes hidden)
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:     }
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: 
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:   # module.set_quota.restapi_object.container_registry_traffic_quota[0] will be updated in-place
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:   ~ resource "restapi_object" "container_registry_traffic_quota" {
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:       ~ data                      = (sensitive value)
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:         id                        = "traffic"
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:       + id_attribute              = "traffic_megabytes"
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:       + ignore_all_server_changes = true
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:         # (14 unchanged attributes hidden)
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212:     }
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: 
TestRunUpgradeExample 2025-10-27T14:24:30Z command.go:212: Plan: 0 to add, 2 to change, 0 to destroy.

In which it is noted that this is update in place and the two knew attributes are added to each request.

@shemau
Copy link
Collaborator Author

shemau commented Oct 27, 2025

/run pipeline

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.

3 participants