-
Notifications
You must be signed in to change notification settings - Fork 1.5k
CORS-2280: IBMCloud: Add TF support for private DNS #6282
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| locals { | ||
| dns_zone_id = var.is_external ? "" : data.ibm_dns_zones.zones[0].dns_zones[index(data.ibm_dns_zones.zones[0].dns_zones[*].name, var.base_domain)].zone_id | ||
| } | ||
|
|
||
| ############################################ | ||
| # DNS Zone | ||
| ############################################ | ||
|
|
||
| data "ibm_dns_zones" "zones" { | ||
| count = var.is_external ? 0 : 1 | ||
|
|
||
| instance_id = var.dns_id | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ############################################ | ||
| # DNS permitted networks | ||
| ############################################ | ||
|
|
||
| resource "ibm_dns_permitted_network" "vpc" { | ||
| count = var.is_external ? 0 : 1 | ||
|
|
||
| instance_id = var.dns_id | ||
| zone_id = local.dns_zone_id | ||
| vpc_crn = var.vpc_crn | ||
| type = "vpc" | ||
| } | ||
|
|
||
| ############################################ | ||
| # DNS records (CNAME) | ||
| ############################################ | ||
|
|
||
| resource "ibm_dns_resource_record" "kubernetes_api_private" { | ||
| count = var.is_external ? 0 : 1 | ||
|
|
||
| instance_id = var.dns_id | ||
| zone_id = local.dns_zone_id | ||
| type = "CNAME" | ||
| name = "api-int.${var.cluster_domain}" | ||
| rdata = var.lb_kubernetes_api_private_hostname | ||
| ttl = "60" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ############################################ | ||
| # DNS module variables | ||
| ############################################ | ||
|
|
||
| variable "dns_id" { | ||
| type = string | ||
| } | ||
|
|
||
| variable "vpc_crn" { | ||
| type = string | ||
| } | ||
|
|
||
| variable "base_domain" { | ||
| type = string | ||
| } | ||
|
|
||
| variable "cluster_domain" { | ||
| type = string | ||
| } | ||
|
|
||
| variable "is_external" { | ||
| type = bool | ||
| } | ||
|
|
||
| variable "lb_kubernetes_api_private_hostname" { | ||
| type = string | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,11 +54,29 @@ module "cis" { | |
| cis_id = var.ibmcloud_cis_crn | ||
| base_domain = var.base_domain | ||
| cluster_domain = var.cluster_domain | ||
| is_external = local.public_endpoints | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider passing this in as a boolean to the ibm-variables where the logic is moved to tfvars in the installer.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The boolean is based on PublishStrategy currently, and just passed around after that. |
||
|
|
||
| lb_kubernetes_api_public_hostname = module.vpc.lb_kubernetes_api_public_hostname | ||
| lb_kubernetes_api_private_hostname = module.vpc.lb_kubernetes_api_private_hostname | ||
| } | ||
|
|
||
| ############################################ | ||
| # DNS module | ||
| ############################################ | ||
|
|
||
| module "dns" { | ||
| source = "./dns" | ||
| depends_on = [module.vpc] | ||
|
|
||
| dns_id = var.ibmcloud_dns_id | ||
| vpc_crn = module.vpc.vpc_crn | ||
| base_domain = var.base_domain | ||
| cluster_domain = var.cluster_domain | ||
| is_external = local.public_endpoints | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider making
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I'll see about following up this PR with some more descriptive |
||
|
|
||
| lb_kubernetes_api_private_hostname = module.vpc.lb_kubernetes_api_private_hostname | ||
| } | ||
|
|
||
| ############################################ | ||
| # Dedicated Host module | ||
| ############################################ | ||
|
|
||
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 don't see any other instance of this variable changed. Is this missing
idor did the type change?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.
This is actually a bug fix, for a bug that was never noticed until we started testing
Internal, which hasn't been supported until this and the previous CORS-2280 PR for Golang changes.For instance, using this PR with a revert of the line above, Terraform fails since the
control_plane_security_group_id_listis a list of Id's (strings) already, not SecurityGroup data sources.