Skip to content

Commit f7c6c9b

Browse files
committed
fix: resolved review comments
1 parent 064c82c commit f7c6c9b

File tree

7 files changed

+44
-21
lines changed

7 files changed

+44
-21
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ To attach access management tags to resources in this module, you need the follo
151151
| Name | Type |
152152
|------|------|
153153
| [ibm_dns_custom_resolver.custom_resolver_hub](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/dns_custom_resolver) | resource |
154-
| [ibm_dns_permitted_network.dns_permitted_nw](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/dns_permitted_network) | resource |
154+
| [ibm_dns_permitted_network.dns_permitted_network](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/dns_permitted_network) | resource |
155155
| [ibm_dns_resource_record.dns_record](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/dns_resource_record) | resource |
156156
| [ibm_dns_zone.dns_zone](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/dns_zone) | resource |
157157
| [ibm_iam_authorization_policy.policy](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/iam_authorization_policy) | resource |
@@ -198,7 +198,7 @@ To attach access management tags to resources in this module, you need the follo
198198
| <a name="input_dns_records"></a> [dns\_records](#input\_dns\_records) | List of DNS records to be created. | <pre>list(object({<br/> name = string<br/> type = string<br/> ttl = number<br/> rdata = string<br/> preference = optional(number, null)<br/> service = optional(string, null)<br/> protocol = optional(string, null)<br/> priority = optional(number, null)<br/> weight = optional(number, null)<br/> port = optional(number, null)<br/> }))</pre> | `[]` | no |
199199
| <a name="input_dns_zone_description"></a> [dns\_zone\_description](#input\_dns\_zone\_description) | The description of the DNS zone. | `string` | `"Default DNS Zone"` | no |
200200
| <a name="input_dns_zone_label"></a> [dns\_zone\_label](#input\_dns\_zone\_label) | Label associated with the DNS zone. | `string` | `"dns-zone"` | no |
201-
| <a name="input_dns_zone_name"></a> [dns\_zone\_name](#input\_dns\_zone\_name) | The name of the DNS zone to be created. | `string` | `null` | no |
201+
| <a name="input_dns_zone_name"></a> [dns\_zone\_name](#input\_dns\_zone\_name) | The name of the DNS zone to be created. | `string` | `"slz.com"` | no |
202202
| <a name="input_enable_hub"></a> [enable\_hub](#input\_enable\_hub) | Indicates whether this VPC is enabled as a DNS name resolution hub. | `bool` | `false` | no |
203203
| <a name="input_enable_hub_vpc_crn"></a> [enable\_hub\_vpc\_crn](#input\_enable\_hub\_vpc\_crn) | Indicates whether Hub VPC CRN is passed. | `bool` | `false` | no |
204204
| <a name="input_enable_hub_vpc_id"></a> [enable\_hub\_vpc\_id](#input\_enable\_hub\_vpc\_id) | Indicates whether Hub VPC ID is passed. | `bool` | `false` | no |
@@ -244,8 +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) | The ID of the DNS zone. The ID is composed of <instance\_id>/<zone\_id> |
248-
| <a name="output_dns_zone_id"></a> [dns\_zone\_id](#output\_dns\_zone\_id) | The ID of the zone that is associated with the DNS zone. |
247+
| <a name="output_dns_zone_id"></a> [dns\_zone\_id](#output\_dns\_zone\_id) | The ID of the DNS zone. |
249248
| <a name="output_dns_zone_state"></a> [dns\_zone\_state](#output\_dns\_zone\_state) | The state of the DNS zone. |
250249
| <a name="output_network_acls"></a> [network\_acls](#output\_network\_acls) | List of shortnames and IDs of network ACLs |
251250
| <a name="output_public_gateways"></a> [public\_gateways](#output\_public\_gateways) | Map of public gateways by zone |

examples/vpc-with-dns/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VPC with DNS example
22

3-
A simple example to provision a Secure Landing Zone (SLZ) Virtual Private Cloud (`VPC`) in two zones (Zone1 and Zone2). Allows creation of Domain Name System (`DNS`) `Zones` and `Records` linking the created `VPC` as a permitted network to the `DNS.`
3+
A simple example demonstrating the provisioning of a `Secure Landing Zone (SLZ) Virtual Private Cloud (VPC)` across two zones (`Zone 1` and `Zone 2`). This setup includes the creation of `Domain Name System (DNS) Zones and Records`, linking the provisioned VPC as a permitted network for DNS operations.
44

55
The following resources are provisioned by this example:
66

examples/vpc-with-dns/outputs.tf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,8 @@ output "dns_zone_state" {
3737
value = module.slz_vpc.dns_zone_state
3838
}
3939

40-
output "dns_zone" {
41-
description = "The ID of the DNS zone. The ID is composed of <instance_id>/<zone_id>"
42-
value = module.slz_vpc.dns_zone
43-
}
44-
4540
output "dns_zone_id" {
46-
description = "The ID of the zone that is associated with the DNS zone."
41+
description = "The ID of the DNS zone."
4742
value = module.slz_vpc.dns_zone_id
4843
}
4944
output "dns_record_ids" {

examples/vpc-with-dns/variables.tf

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ variable "prefix" {
1919
variable "name" {
2020
description = "The name of the vpc"
2121
type = string
22-
default = "sz-vpc"
22+
default = "slz-vpc"
2323
}
2424

2525
variable "resource_group" {
@@ -48,9 +48,40 @@ variable "dns_records" {
4848
service = optional(string)
4949
weight = optional(number)
5050
}))
51+
default = [
52+
{
53+
name = "testA"
54+
type = "A"
55+
rdata = "1.2.3.4"
56+
ttl = 3600
57+
},
58+
{
59+
name = "testMX"
60+
type = "MX"
61+
rdata = "mailserver.test.com"
62+
preference = 10
63+
},
64+
{
65+
type = "SRV"
66+
name = "testSRV"
67+
rdata = "tester.com"
68+
priority = 100
69+
weight = 100
70+
port = 8000
71+
service = "_sip"
72+
protocol = "udp"
73+
},
74+
{
75+
name = "testTXT"
76+
type = "TXT"
77+
rdata = "textinformation"
78+
ttl = 900
79+
}
80+
]
5181
}
5282

5383
variable "dns_zone_name" {
5484
description = "The name of the DNS zone to be created."
5585
type = string
86+
default = "dns-example.com"
5687
}

main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ resource "ibm_dns_zone" "dns_zone" {
370370
# DNS PERMITTED NETWORK
371371
##############################################################################
372372

373-
resource "ibm_dns_permitted_network" "dns_permitted_nw" {
373+
resource "ibm_dns_permitted_network" "dns_permitted_network" {
374374
count = var.enable_hub && !var.skip_custom_resolver_hub_creation ? 1 : 0
375375
instance_id = var.use_existing_dns_instance ? var.existing_dns_instance_id : ibm_resource_instance.dns_instance_hub[0].guid
376376
zone_id = ibm_dns_zone.dns_zone[0].zone_id
@@ -382,6 +382,9 @@ resource "ibm_dns_permitted_network" "dns_permitted_nw" {
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+
}
385388
resource "ibm_dns_resource_record" "dns_record" {
386389

387390
for_each = { for idx, record in var.dns_records : idx => record }

outputs.tf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,12 @@ output "dns_zone_state" {
183183
value = length(ibm_dns_zone.dns_zone) > 0 ? ibm_dns_zone.dns_zone[0].state : null
184184
}
185185

186-
output "dns_zone" {
187-
description = "The ID of the DNS zone. The ID is composed of <instance_id>/<zone_id>"
188-
value = length(ibm_dns_zone.dns_zone) > 0 ? ibm_dns_zone.dns_zone[0].id : null
189-
}
190-
191186
output "dns_zone_id" {
192-
description = "The ID of the zone that is associated with the DNS zone."
187+
description = "The ID of the DNS zone."
193188
value = length(ibm_dns_zone.dns_zone) > 0 ? ibm_dns_zone.dns_zone[0].zone_id : null
194189
}
195190

196191
output "dns_record_ids" {
197192
description = "List of all the domain resource records."
198-
value = [for record in ibm_dns_resource_record.dns_record : record.id]
193+
value = length(ibm_dns_resource_record.dns_record) > 0 ? local.record_ids : null
199194
}

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ variable "dns_plan" {
640640

641641
variable "dns_zone_name" {
642642
description = "The name of the DNS zone to be created."
643-
default = null
643+
default = "slz.com"
644644
type = string
645645
}
646646

0 commit comments

Comments
 (0)