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

fix: add reserved ip names for gateways #437

Merged
merged 4 commits into from
Nov 16, 2023
Merged

fix: add reserved ip names for gateways #437

merged 4 commits into from
Nov 16, 2023

Conversation

shemau
Copy link
Contributor

@shemau shemau commented Nov 9, 2023

Description

Give option to name vpe ips.

#435

Release required?

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

During an upgrade to this version the following update in place changes may be present in terraform output

  # module.vpes.ibm_is_subnet_reserved_ip.ip["vpe-vpc-instance-subnet-c-postgresql-gateway-3-ip"] will be updated in-place
  ~ resource "ibm_is_subnet_reserved_ip" "ip" {
        id              = "0737-f3c78bfa-c8d8-4c45-bead-7e74a738224c/0737-c211fbb2-f63a-447c-a607-7907c0d17e97"
      ~ name            = "boneset-starboard-headsman-bonelet" -> "vpe-vpc-instance-postgresql-3"
        # (11 unchanged attributes hidden)
    }

A subsequent deploy might also show

Changes to Outputs:
  ~ vpe_ips = {
      ~ vpe-vpc-instance-postgresql           = [
          ~ {
                id            = "0717-58a27750-f8b1-4972-a3ed-f47b29cdf693"
              ~ name          = "baton-numeral-chive-ducking" -> "vpe-vpc-instance-postgresql-1"
                # (2 unchanged attributes hidden)
            },
          ~ {
                id            = "0727-55bc587c-5f3e-4295-a41a-60187681af08"
              ~ name          = "circular-saucy-settling-persecute" -> "vpe-vpc-instance-postgresql-2"
                # (2 unchanged attributes hidden)
            },
          ~ {
                id            = "0737-c211fbb2-f63a-447c-a607-7907c0d17e97"
              ~ name          = "boneset-starboard-headsman-bonelet" -> "vpe-vpc-instance-postgresql-3"
                # (2 unchanged attributes hidden)
            },
        ]

which is a change to outputs and resolved by terraform refresh

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 shemau mentioned this pull request Nov 9, 2023
6 tasks
@jor2 jor2 self-requested a review November 10, 2023 13:51
jor2
jor2 previously approved these changes Nov 10, 2023
@shemau
Copy link
Contributor Author

shemau commented Nov 14, 2023

/run pipeline

@ocofaigh
Copy link
Member

@shemau Pipeline is failing with this. Is this expected?

        	Messages:   	Resource(s) identified to be updated 
        	            	Name: ip
        	            	Address: module.vpes.ibm_is_subnet_reserved_ip.ip["vpe-upgrade-wqdqqb-vpc-instance-subnet-a-postgresql-gateway-1-ip"]
        	            	Actions: [update]
        	            	DIFF:
        	            	  Before: 
        	            		{"name":"urethane-sulfate-barometer-rind"}
        	            	  After: 
        	            		{"name":"vpe-upgrade-wqdqqb-vpc-instance-postgresql-1"}

@jor2
Copy link
Member

jor2 commented Nov 15, 2023

@shemau Pipeline is failing with this. Is this expected?

        	Messages:   	Resource(s) identified to be updated 
        	            	Name: ip
        	            	Address: module.vpes.ibm_is_subnet_reserved_ip.ip["vpe-upgrade-wqdqqb-vpc-instance-subnet-a-postgresql-gateway-1-ip"]
        	            	Actions: [update]
        	            	DIFF:
        	            	  Before: 
        	            		{"name":"urethane-sulfate-barometer-rind"}
        	            	  After: 
        	            		{"name":"vpe-upgrade-wqdqqb-vpc-instance-postgresql-1"}

looks expected. it was using a random name before.

@jor2 jor2 self-requested a review November 15, 2023 15:51
@@ -37,6 +37,7 @@ locals {
ip_name = "${subnet.name}-${service.service_name}-gateway-${replace(subnet.zone, "/${var.region}-/", "")}-ip"
subnet_id = subnet.id
gateway_name = service.vpe_name != null ? service.vpe_name : "${var.prefix}-${var.vpc_name}-${service.service_name}"
name = service.vpe_name != null ? "${service.vpe_name}-${replace(subnet.zone, "/${var.region}-/", "")}" : "${var.prefix}-${var.vpc_name}-${service.service_name}-${replace(subnet.zone, "/${var.region}-/", "")}"
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference between ip_name and name?

Copy link
Member

Choose a reason for hiding this comment

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

in terms of why do we need both

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ip_name is currently used as the map index. If we change the map key name, the map entry gets removed and a new one gets created, which results in a destroy / create. If we leave the map key name untouched and just change the name of the resource it results in a update in place.
The name is actually based on the gateway_name with a -1, -2 or -3 taken from the zone (eg. us-south-1), which both shorter and has a user override in it.

@shemau
Copy link
Contributor Author

shemau commented Nov 15, 2023

/run pipeline

@shemau
Copy link
Contributor Author

shemau commented Nov 15, 2023

@shemau Pipeline is failing with this. Is this expected?

        	Messages:   	Resource(s) identified to be updated 
        	            	Name: ip
        	            	Address: module.vpes.ibm_is_subnet_reserved_ip.ip["vpe-upgrade-wqdqqb-vpc-instance-subnet-a-postgresql-gateway-1-ip"]
        	            	Actions: [update]
        	            	DIFF:
        	            	  Before: 
        	            		{"name":"urethane-sulfate-barometer-rind"}
        	            	  After: 
        	            		{"name":"vpe-upgrade-wqdqqb-vpc-instance-postgresql-1"}

looks expected. it was using a random name before.

Yes. This is the expected upgrade delta. I have confirmed that this is an update in place (not a delete/recreate), which avoids upgrade outages. This was the only error (for each of the 9 ips), so it can safely be skipped. The latest commit should skip the upgrade test (and add a comment to the readme).

@ocofaigh ocofaigh merged commit 32dc9bd into main Nov 16, 2023
2 checks passed
@ocofaigh ocofaigh deleted the reserved-ip-name branch November 16, 2023 13:58
@terraform-ibm-modules-ops
Copy link
Contributor

🎉 This PR is included in version 4.1.0 🎉

The release is available on GitHub release

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.

None yet

4 participants