Skip to content

feat: support for restapi major bump to 2.0 #312

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
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

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

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