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

use the cluster subnet to look up the node cidr block #1783

Merged

Conversation

danawillow
Copy link
Contributor

Before, we read the SubnetworkName field in IpAllocationPolicy, which appears to not get set when we don't specify it directly.

This fixes TestAccContainerCluster_withIPAllocationPolicy_specificIPRanges


[all]

[terraform]

[terraform-beta]

[ansible]

[inspec]

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
This PR seems not to have generated downstream PRs before, as of 358134b.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#722
depends: hashicorp/terraform-provider-google#3654

}
} else {
nodeCidrBlock := ""
if c.Subnetwork != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Since every cluster has a subnetwork, won't we be reading this in cases where create_subnetwork isn't true as well? I think we need to guard on that as well.

subnetwork_name is only usable when create_subnetwork is true, so previously we were only filling in the value on a subset of cases where it was valid. Unless I'm missing something, after this change we'll fill it in whenever this block is returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is that an issue if it's a computed field? (we still set the subnetwork name to the one returned in the ipallocationpolicy block, so it's only the nodeCidrBlock that gets filled in in more cases now)

Copy link
Member

Choose a reason for hiding this comment

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

Oh! Ignore me, I didn't notice it was Computed.

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Do you mind noting in the docs that the field relies on create_subnetwork being true? https://www.terraform.io/docs/providers/google/r/container_cluster.html#node_ipv4_cidr_block

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 2f77c3f.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

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

Successfully merging this pull request may close these issues.

4 participants