-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: expose hub vpc inputs #662
Conversation
Can add validation to check both "enable_hub" and "enable_hub_vpc" are not true at the same time once @vburckhardt PR is in. |
Hi @rajatagarwal-ibm - the goal here is not to create a second VPC, but to expose the variable in the interface of the module allowing a consumer to use this module to create a spoke VPC. |
resource "ibm_is_vpc_dns_resolution_binding" "vpc_dns_resolution_binding" { | ||
count = var.hub_vpc_id != null ? 1 : 0 | ||
name = "${var.prefix}-dns-binding" | ||
vpc_id = ibm_is_vpc.vpc.id # Source VPC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you just double check that the source should be the vpc id as opposed to the hub vpc. Doc is not very clear on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the docs are not very clear. However, looking at the curl command below gives a better picture. In the highlighted part "hub_vpc_id" is passed in the vpc block, which is similar to the terraform block.
curl -sX POST "$vpc_api_endpoint/v1/vpcs/$spoke_vpc_id/dns_resolution_bindings?version=$version&generation=2" -H "Authorization: Bearer ${iam_token}" -d '{"vpc": {"id": "'$hub_vpc_id'"}}'
That's from the documentation https://cloud.ibm.com/docs/vpc?topic=vpc-hub-spoke-resolution-bindings&interface=api
/run pipeline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small comment.
main.tf
Outdated
@@ -25,6 +28,30 @@ resource "ibm_is_vpc" "vpc" { | |||
|
|||
dns { | |||
enable_hub = var.enable_hub | |||
# Creates a delegated resolver. Requires dns.enable_hub to be false. | |||
resolver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using a dynamic block would make the code more readable here and avoid the repeats.
Also perhaps double check that having a resolver of type null is not going to throw an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no it won't throw an error, have a look at the below findings.
I have also added a check if Here is the terraform plan for the basic example in all the scenarios:
|
Ran both pr_test and others_test locally, and both passed
|
🎉 This PR is included in version 7.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
hub_vpc_id input (used in spoke vpc)
Release required?
x.x.X
)x.X.x
)X.x.x
)Release notes content
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:
Checklist for reviewers
For mergers