Skip to content

Commit fb7bc50

Browse files
committed
fix: resolved review comments
1 parent 2a12cb9 commit fb7bc50

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ To attach access management tags to resources in this module, you need the follo
244244
| <a name="output_dns_endpoint_gateways_by_id"></a> [dns\_endpoint\_gateways\_by\_id](#output\_dns\_endpoint\_gateways\_by\_id) | The list of VPEs that are made available for DNS resolution in the created VPC. Only set if enable\_hub is false and enable\_hub\_vpc\_id are true. |
245245
| <a name="output_dns_instance_id"></a> [dns\_instance\_id](#output\_dns\_instance\_id) | The ID of the DNS instance. |
246246
| <a name="output_dns_record_ids"></a> [dns\_record\_ids](#output\_dns\_record\_ids) | List of all the domain resource records. |
247+
| <a name="output_dns_zone"></a> [dns\_zone](#output\_dns\_zone) | A map representing DNS zone information. |
247248
| <a name="output_dns_zone_id"></a> [dns\_zone\_id](#output\_dns\_zone\_id) | The ID of the DNS zone. |
248249
| <a name="output_dns_zone_state"></a> [dns\_zone\_state](#output\_dns\_zone\_state) | The state of the DNS zone. |
249250
| <a name="output_network_acls"></a> [network\_acls](#output\_network\_acls) | List of shortnames and IDs of network ACLs |

examples/vpc-with-dns/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ output "dns_record_ids" {
4545
description = "List of all the domain resource records."
4646
value = module.slz_vpc.dns_record_ids
4747
}
48+
49+
output "dns_zone" {
50+
description = "A map representing DNS zone information."
51+
value = module.slz_vpc.dns_zone
52+
}

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,6 @@ resource "ibm_dns_permitted_network" "dns_permitted_network" {
382382
# DNS Records
383383
##############################################################################
384384

385-
locals {
386-
record_ids = [for record in ibm_dns_resource_record.dns_record : element(split("/", record.id), 2)]
387-
}
388385
resource "ibm_dns_resource_record" "dns_record" {
389386

390387
for_each = { for idx, record in var.dns_records : idx => record }
@@ -408,4 +405,8 @@ resource "ibm_dns_resource_record" "dns_record" {
408405
preference = each.value.type == "MX" ? each.value.preference : null
409406
}
410407

408+
locals {
409+
record_ids = [for record in ibm_dns_resource_record.dns_record : element(split("/", record.id), 2)]
410+
}
411+
411412
##############################################################################

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ output "dns_zone_id" {
188188
value = length(ibm_dns_zone.dns_zone) > 0 ? ibm_dns_zone.dns_zone[0].zone_id : null
189189
}
190190

191+
output "dns_zone" {
192+
description = "A map representing DNS zone information."
193+
value = length(ibm_dns_zone.dns_zone) > 0 ? ibm_dns_zone.dns_zone[0] : null
194+
}
195+
191196
output "dns_record_ids" {
192197
description = "List of all the domain resource records."
193198
value = length(ibm_dns_resource_record.dns_record) > 0 ? local.record_ids : null

variables.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,22 @@ variable "dns_zone_name" {
642642
description = "The name of the DNS zone to be created."
643643
default = "slz.com"
644644
type = string
645+
validation {
646+
condition = !contains([
647+
"ibm.com",
648+
"softlayer.com",
649+
"bluemix.net",
650+
"softlayer.local",
651+
"mybluemix.net",
652+
"networklayer.com",
653+
"ibmcloud.com",
654+
"pdnsibm.net",
655+
"appdomain.cloud",
656+
"compass.cobaltiron.com"
657+
], var.dns_zone_name)
658+
659+
error_message = "The specified DNS zone name is not permitted. Please choose a different domain name. [Learn more](https://cloud.ibm.com/docs/dns-svcs?topic=dns-svcs-managing-dns-zones&interface=ui#restricted-dns-zone-names)"
660+
}
645661
}
646662

647663
variable "dns_zone_description" {

0 commit comments

Comments
 (0)