From 61ec91767ba426023ac1de073776f10321e3eeee Mon Sep 17 00:00:00 2001 From: Sergey Kudriavtsev Date: Mon, 10 Apr 2023 03:36:02 +0200 Subject: [PATCH] more fixes for the documentation and the examples --- README.md | 2 +- docs/data-sources/infoblox_a_record.md | 18 ++++++++++++- docs/data-sources/infoblox_aaaa_record.md | 15 ++++++++++- docs/data-sources/infoblox_cname_record.md | 18 ++++++++++++- docs/data-sources/infoblox_ipv4_network.md | 17 +++++++++++- .../infoblox_ipv4_network_container.md | 14 ++++++++++ docs/data-sources/infoblox_mx_record.md | 26 ++++++++++--------- docs/data-sources/infoblox_network_view.md | 12 +++++++++ docs/data-sources/infoblox_ptr_record.md | 14 ++++++++++ docs/data-sources/infoblox_srv_record.md | 4 ++- docs/data-sources/infoblox_txt_record.md | 4 ++- docs/resources/infoblox_srv_record.md | 2 +- docs/resources/infoblox_txt_record.md | 2 +- examples/datasources/infoblox_ipv4_network.tf | 2 +- .../infoblox_ipv4_network_container.tf | 2 +- examples/resources/infoblox_srv_record.tf | 2 +- examples/resources/infoblox_txt_record.tf | 2 +- 17 files changed, 131 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 8c328d24f..ee875891c 100644 --- a/README.md +++ b/README.md @@ -106,5 +106,5 @@ The limitations of Infoblox IPAM Plug-In for Terraform version 2.3.0 are as foll * `infoblox_ipv6_allocation` * `infoblox_ipv4_association` * `infoblox_ipv6_association` -* The Update functionality is currently not working for the CIDR field in A, AAAA, and PTR records. +* The Update functionality is currently not working for the CIDR field in A and AAAA records. * The fetch functionality in data sources returns output for only one matching object even if it finds multiple objects matching the search criteria. diff --git a/docs/data-sources/infoblox_a_record.md b/docs/data-sources/infoblox_a_record.md index 55585b970..20e74ee15 100644 --- a/docs/data-sources/infoblox_a_record.md +++ b/docs/data-sources/infoblox_a_record.md @@ -22,10 +22,26 @@ You can reference this resource and retrieve information about it. For example, a text as is a comment for the A-record. ```hcl +resource "infoblox_a_record" "vip_host" { + fqdn = "very-interesting-host.example.com" + ip_addr = "10.3.1.65" + comment = "special host" + dns_view = "nondefault_dnsview2" + ttl = 120 // 120s + ext_attrs = jsonencode({ + "Location" = "65.8665701230204, -37.00791763398113" + }) +} + + data "infoblox_a_record" "vip_host" { - dns_view="default" + dns_view="nondefault_dnsview2" fqdn="very-interesting-host.example.com" ip_addr="10.3.1.65" + + // This is just to ensure that the record has been be created + // using 'infoblox_a_record' resource block before the data source will be queried. + depends_on = [infoblox_a_record.vip_host] } output "vip_host_id" { diff --git a/docs/data-sources/infoblox_aaaa_record.md b/docs/data-sources/infoblox_aaaa_record.md index 46f8a9807..de3615c12 100644 --- a/docs/data-sources/infoblox_aaaa_record.md +++ b/docs/data-sources/infoblox_aaaa_record.md @@ -22,10 +22,23 @@ You can reference this resource and retrieve information about it. For example, a text as is a comment for the AAAA-record. ```hcl +resource "infoblox_aaaa_record" "vip_host" { + fqdn = "very-interesting-host.example.com" + ipv6_addr = "2a05:d014:275:cb00:ec0d:12e2:df27:aa60" + comment = "some comment" + ttl = 120 // 120s + ext_attrs = jsonencode({ + "Location" = "65.8665701230204, -37.00791763398113" + }) +} + data "infoblox_aaaa_record" "vip_host" { - dns_view="default" fqdn="very-interesting-host.example.com" ipv6_addr="2a05:d014:275:cb00:ec0d:12e2:df27:aa60" + + // This is just to ensure that the record has been be created + // using 'infoblox_aaaa_record' resource block before the data source will be queried. + depends_on = [infoblox_aaaa_record.vip_host] } output "vip_host_id" { diff --git a/docs/data-sources/infoblox_cname_record.md b/docs/data-sources/infoblox_cname_record.md index 6ccf15042..28101c3b0 100644 --- a/docs/data-sources/infoblox_cname_record.md +++ b/docs/data-sources/infoblox_cname_record.md @@ -18,10 +18,26 @@ The following list describes the parameters you must define in an `infoblox_cnam ### Example of the CNAME-record Data Source Block ```hcl +resource "infoblox_cname_record" "foo" { + dns_view = "default.nondefault_netview" + canonical = "strange-place.somewhere.in.the.net" + alias = "foo.test.com" + comment = "we need to keep an eye on this strange host" + ttl = 0 // disable caching + ext_attrs = jsonencode({ + Site = "unknown" + Location = "TBD" + }) +} + data "infoblox_cname_record" "foo"{ - dns_view="default" + dns_view="default.nondefault_netview" alias="foo.test.com" canonical="main.test.com" + + // This is just to ensure that the record has been be created + // using 'infoblox_cname_record' resource block before the data source will be queried. + depends_on = [infoblox_cname_record.foo] } output "foo_ttl" { diff --git a/docs/data-sources/infoblox_ipv4_network.md b/docs/data-sources/infoblox_ipv4_network.md index 8b422c2be..b7483b248 100644 --- a/docs/data-sources/infoblox_ipv4_network.md +++ b/docs/data-sources/infoblox_ipv4_network.md @@ -15,9 +15,24 @@ The following list describes the parameters you must define in an `infoblox_ipv4 ### Example of a Network Data Source Block ```hcl +resource "infoblox_ipv4_network" "net2" { + cidr = "192.168.128.0/20" + network_view = "nondefault_netview" + reserve_ip = 5 + gateway = "192.168.128.254" + comment = "small network for testing" + ext_attrs = jsonencode({ + "Site" = "bla-bla-bla... testing..." + }) +} + data "infoblox_ipv4_network" "nearby_network" { - network_view = "default" + network_view = "nondefault_netview" cidr = "192.168.128.0/20" + + // This is just to ensure that the network has been be created + // using 'infoblox_ipv4_network' resource block before the data source will be queried. + depends_on = [infoblox_ipv4_network.net2] } output "nearby_network_comment" { diff --git a/docs/data-sources/infoblox_ipv4_network_container.md b/docs/data-sources/infoblox_ipv4_network_container.md index b648a1f4f..31327957f 100644 --- a/docs/data-sources/infoblox_ipv4_network_container.md +++ b/docs/data-sources/infoblox_ipv4_network_container.md @@ -17,9 +17,23 @@ in an `infoblox_ipv4_network_container` data source block (all of them are requi ### Example of an IPv4 Network Container Data Source Block ```hcl +resource "infoblox_ipv4_network_container" "nearby_org" { + cidr = "192.168.128.0/16" + network_view = "separate_tenants" + comment = "one of our clients" + ext_attrs = jsonencode({ + "Site" = "remote office" + "Country" = "Australia" + }) +} + data "infoblox_ipv4_network_container" "nearby_org" { network_view = "separate_tenants" cidr = "192.168.128.0/16" + + // This is just to ensure that the network container has been be created + // using 'infoblox_ipv4_network_container' resource block before the data source will be queried. + depends_on = [infoblox_ipv4_network_container.nearby_org] } output "nearby_org_comment" { diff --git a/docs/data-sources/infoblox_mx_record.md b/docs/data-sources/infoblox_mx_record.md index 7dee2d0df..07c8c7475 100644 --- a/docs/data-sources/infoblox_mx_record.md +++ b/docs/data-sources/infoblox_mx_record.md @@ -35,22 +35,24 @@ data "infoblox_mx_record" "ds2" { mail_exchanger = "sample.test.com" preference = 40 + // This is just to ensure that the record has been be created + // using 'infoblox_mx_record' resource block before the data source will be queried. depends_on = [infoblox_mx_record.rec2] +} - output "mx_rec2_zone" { - value = data.infoblox_mx_record.ds2.zone - } +output "mx_rec2_zone" { + value = data.infoblox_mx_record.ds2.zone +} - output "mx_rec2_ttl" { - value = data.infoblox_mx_record.ds2.ttl - } +output "mx_rec2_ttl" { + value = data.infoblox_mx_record.ds2.ttl +} - output "mx_rec2_comment" { - value = data.infoblox_mx_record.ds2.comment - } +output "mx_rec2_comment" { + value = data.infoblox_mx_record.ds2.comment +} - output "mx_rec2_ext_attrs" { - value = data.infoblox_mx_record.ds2.ext_attrs - } +output "mx_rec2_ext_attrs" { + value = data.infoblox_mx_record.ds2.ext_attrs } ``` diff --git a/docs/data-sources/infoblox_network_view.md b/docs/data-sources/infoblox_network_view.md index 05a17fbd9..ba95b01ed 100644 --- a/docs/data-sources/infoblox_network_view.md +++ b/docs/data-sources/infoblox_network_view.md @@ -10,8 +10,20 @@ To get information about a network view, you must specify a name of the network ### Example of a Network View Data Source Block ```hcl +resource "infoblox_network_view" "inet_nv" { + name = "inet_visible_nv" + comment = "Internet-facing networks" + ext_attrs = jsonencode({ + "Location" = "the North pole" + }) +} + data "infoblox_network_view" "inet_nv" { name = "inet_visible_nv" + + // This is just to ensure that the network view has been be created + // using 'infoblox_network_view' resource block before the data source will be queried. + depends_on = [infoblox_network_view.inet_nv] } output "inet_nv_ext_attrs" { diff --git a/docs/data-sources/infoblox_ptr_record.md b/docs/data-sources/infoblox_ptr_record.md index 949d27ce0..917b46612 100644 --- a/docs/data-sources/infoblox_ptr_record.md +++ b/docs/data-sources/infoblox_ptr_record.md @@ -26,10 +26,24 @@ You can reference this resource and retrieve information about it. For example, `data.infoblox_ptr_record.vip_host.comment` returns a textual content of comment field for the PTR-record. ```hcl +resource "infoblox_ptr_record" "host1" { + ptrdname = "host.example.org" + ip_addr = "2a05:d014:275:cb00:ec0d:12e2:df27:aa60" + comment = "workstation #3" + ttl = 300 # 5 minutes + ext_attrs = jsonencode({ + "Location" = "the main office" + }) +} + data "infoblox_ptr_record" "host1" { // dns_view="default" // may be omitted ptrdname="host.example.org" ip_addr="2a05:d014:275:cb00:ec0d:12e2:df27:aa60" + + // This is just to ensure that the record has been be created + // using 'infoblox_ptr_record' resource block before the data source will be queried. + depends_on = [infoblox_ptr_record.host1] } output "host1_id" { diff --git a/docs/data-sources/infoblox_srv_record.md b/docs/data-sources/infoblox_srv_record.md index ff32afb8c..d7618f824 100644 --- a/docs/data-sources/infoblox_srv_record.md +++ b/docs/data-sources/infoblox_srv_record.md @@ -34,11 +34,13 @@ resource "infoblox_srv_record" "rec2" { } data "infoblox_srv_record" "ds1" { - dns_view = "nondefault_dnsview1" // not 'default' thus must be specified + dns_view = "nondefault_dnsview1" name = "_sip._udp.example2.org" port = 5060 target = "sip.example2.org" + // This is just to ensure that the record has been be created + // using 'infoblox_srv_record' resource block before the data source will be queried. depends_on = [infoblox_srv_record.rec2] } diff --git a/docs/data-sources/infoblox_txt_record.md b/docs/data-sources/infoblox_txt_record.md index 416454c20..b2d2784e5 100644 --- a/docs/data-sources/infoblox_txt_record.md +++ b/docs/data-sources/infoblox_txt_record.md @@ -28,9 +28,11 @@ resource "infoblox_txt_record" "rec3" { } data "infoblox_txt_record" "ds3" { - dns_view = "nondefault_dnsview1" // not 'default' thus must be specified + dns_view = "nondefault_dnsview1" fqdn = "example3.example2.org" + // This is just to ensure that the record has been be created + // using 'infoblox_txt_record' resource block before the data source will be queried. depends_on = [infoblox_txt_record.rec3] } diff --git a/docs/resources/infoblox_srv_record.md b/docs/resources/infoblox_srv_record.md index 1aaa23d97..938bf20a2 100644 --- a/docs/resources/infoblox_srv_record.md +++ b/docs/resources/infoblox_srv_record.md @@ -29,7 +29,7 @@ resource "infoblox_srv_record" "rec1" { // all set of parameters for SRV record resource "infoblox_srv_record" "rec2" { - dns_view = "nondefault_dnsview1" // not 'default' thus must be specified + dns_view = "nondefault_dnsview1" name = "_sip._udp.example2.org" priority = 12 weight = 10 diff --git a/docs/resources/infoblox_txt_record.md b/docs/resources/infoblox_txt_record.md index 0539d39a4..b706f5a0c 100644 --- a/docs/resources/infoblox_txt_record.md +++ b/docs/resources/infoblox_txt_record.md @@ -30,7 +30,7 @@ resource "infoblox_txt_record" "rec2" { // all the parameters for a TXT-Record resource "infoblox_txt_record" "rec3" { - dns_view = "nondefault_dnsview1" // not 'default' thus must be specified + dns_view = "nondefault_dnsview1" fqdn = "example3.example2.org" text = "data for TXT-record #3" ttl = 300 diff --git a/examples/datasources/infoblox_ipv4_network.tf b/examples/datasources/infoblox_ipv4_network.tf index 313f93da2..3cc19b993 100644 --- a/examples/datasources/infoblox_ipv4_network.tf +++ b/examples/datasources/infoblox_ipv4_network.tf @@ -1,6 +1,6 @@ data "infoblox_ipv4_network" "net1" { cidr = "10.1.0.0/24" - network_view = "nondefault_netview" // optional, but it differs from 'default' + network_view = "nondefault_netview" depends_on = [infoblox_ipv4_network.net1] } diff --git a/examples/datasources/infoblox_ipv4_network_container.tf b/examples/datasources/infoblox_ipv4_network_container.tf index d2776c070..e5fab084c 100644 --- a/examples/datasources/infoblox_ipv4_network_container.tf +++ b/examples/datasources/infoblox_ipv4_network_container.tf @@ -1,6 +1,6 @@ data "infoblox_ipv4_network_container" "nc2" { cidr = "10.2.0.0/24" - network_view = "nondefault_netview" // optional, but it differs from 'default' + network_view = "nondefault_netview" depends_on = [infoblox_ipv4_network_container.nc2] } diff --git a/examples/resources/infoblox_srv_record.tf b/examples/resources/infoblox_srv_record.tf index 8a4a79779..f637e859c 100644 --- a/examples/resources/infoblox_srv_record.tf +++ b/examples/resources/infoblox_srv_record.tf @@ -9,7 +9,7 @@ resource "infoblox_srv_record" "rec1" { // all set of parameters for SRV record resource "infoblox_srv_record" "rec2" { - dns_view = "nondefault_dnsview1" // not 'default' thus must be specified + dns_view = "nondefault_dnsview1" name = "_sip._udp.example2.org" priority = 12 weight = 10 diff --git a/examples/resources/infoblox_txt_record.tf b/examples/resources/infoblox_txt_record.tf index 6293c2d5b..5cf7f0258 100644 --- a/examples/resources/infoblox_txt_record.tf +++ b/examples/resources/infoblox_txt_record.tf @@ -14,7 +14,7 @@ resource "infoblox_txt_record" "rec2" { // all the parameters for a TXT-Record resource "infoblox_txt_record" "rec3" { - dns_view = "nondefault_dnsview1" // not 'default' thus must be specified + dns_view = "nondefault_dnsview1" fqdn = "example3.example2.org" text = "data for TXT-record #3" ttl = 300