Skip to content

Conversation

@iamar7
Copy link
Member

@iamar7 iamar7 commented Aug 3, 2025

Description

Add Opt-In Support for major openShift version upgrades via terraform

Release required?

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

This PR introduces a new variable, enable_openshift_version_upgrade, which allows users to perform openshift version upgrades with Terraform. However, when enable_openshift_version_upgrade is set to true, Terraform may plan to destroy and re-create the cluster because the resource type in the module changes. To prevent this, you must migrate the existing state to the new resource address before applying any changes. This is a one time migration of the state.

There are several options to do this:

Use terraform moved blocks (recommended)

The recommended approach is to use Terraform's native moved block feature:
Example assuming your OCP module is called "ocp"

moved {
  from = module.ocp.ibm_container_vpc_cluster.cluster[0]
  to   = module.ocp.ibm_container_vpc_cluster.cluster_with_upgrade[0]
}

For auto-scaling clusters:

moved {
  from = module.ocp.ibm_container_vpc_cluster.autoscaling_cluster[0]
  to   = module.ocp.ibm_container_vpc_cluster.autoscaling_cluster_with_upgrade[0]
}

Add this block to your Terraform configuration, run terraform plan to verify the state migration, then terraform apply to apply the changes. This approach works for both local Terraform and Schematics deployments.

Perform manual state migration

For a standard cluster

terraform state mv \
  'module.ocp_base.ibm_container_vpc_cluster.cluster[0]' \
  'module.ocp_base.ibm_container_vpc_cluster.cluster_with_upgrade[0]'

For an autoscaling cluster

terraform state mv \
  'module.ocp_base.ibm_container_vpc_cluster.autoscaling_cluster[0]' \
  'module.ocp_base.ibm_container_vpc_cluster.autoscaling_cluster_with_upgrade[0]'

After migrating the state, run a terraform refresh to synchronize the state file with the actual cluster. For more details refer here.

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.

@iamar7
Copy link
Member Author

iamar7 commented Aug 3, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Aug 5, 2025

/run pipeline

@iamar7 iamar7 changed the title feat: add support for major openshift version upgrade [WIP] feat: add support for major openshift version upgrade Aug 5, 2025
@iamar7 iamar7 closed this Aug 21, 2025
@iamar7 iamar7 reopened this Sep 19, 2025
@iamar7
Copy link
Member Author

iamar7 commented Sep 19, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Sep 19, 2025

/run pipeline

@iamar7 iamar7 changed the title [WIP] feat: add support for major openshift version upgrade feat: add support for major openshift version upgrade Sep 19, 2025
@iamar7
Copy link
Member Author

iamar7 commented Sep 22, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Sep 22, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Sep 22, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Sep 23, 2025

/run pipeline

1 similar comment
@iamar7
Copy link
Member Author

iamar7 commented Sep 23, 2025

/run pipeline

Copy link
Member

@vburckhardt vburckhardt left a comment

Choose a reason for hiding this comment

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

Some comments below also add some documentation on how to migrate, and consider adding a migration helper script

@iamar7
Copy link
Member Author

iamar7 commented Oct 10, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Oct 10, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Oct 10, 2025

/run pipeline

@iamar7 iamar7 requested a review from ocofaigh October 10, 2025 22:05
@iamar7
Copy link
Member Author

iamar7 commented Oct 13, 2025

/run pipeline

@vburckhardt
Copy link
Member

/run pipeline

@vburckhardt
Copy link
Member

/run pipeline

@vburckhardt
Copy link
Member

This also only requires a minor release, not a major one.

vburckhardt
vburckhardt previously approved these changes Oct 13, 2025
Copy link
Member

@vburckhardt vburckhardt left a comment

Choose a reason for hiding this comment

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

I think this got to the state where it needs to be. This needs to go ahead when pipeline passes, as going since August.

@vburckhardt
Copy link
Member

/run pipeline

@ocofaigh ocofaigh merged commit 16b9dfe into main Oct 13, 2025
2 checks passed
@ocofaigh ocofaigh deleted the 15216-optin branch October 13, 2025 15:11
@terraform-ibm-modules-ops
Copy link
Contributor

🎉 This PR is included in version 3.64.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants