Skip to content

Commit

Permalink
Feature Branch for ib go client migration (#317)
Browse files Browse the repository at this point in the history
* Migrated terraform provider to a new version of IB go cli

* Updated some of the field usages, since many of the
  fields in new client are now references instead of
  original objects.

* Updated some terraform-plugin-sdk dependencies to run
  acceptance tests.

* Updated terraform-plugin-sdk dependency

* Updated terraform-plugin-sdk dependency from v2.4.3 to
  v2.27.0.

* Changed "network" data source

* Implemented a new way to search for a network resource
  using filters. EA search is supported by appending
  asterisk to the search key.

* Updated vendor dir after upgrading terraform-provider-sdk

* Changed network container data source

* Rewrote read schema and logic for network container data
  source. Search by extensible attributes is now available
  for this data source.

* Fixed small bugs for network data source

* Changed network view data source

* Rewrote read schema and logic for network view data
  source. Search by extensible attributes is now available
  for this data source.

* Changed terraform-plugin-sdk version from v2.27.0 to v2.19.0

* Version v2.27.0 is not compatible with go 1.17, which is
   used to compile this terraform provider.

* Fixed resource_infoblox_cname_record_test.go

* Some checks were failing because of updated field types
  in CNAME record struct.

* Updated 'ext_attrs' field in the network resource

* Changed 'ext_attrs' field type from String to Map.

* Added extAttrsDiffSuppressFunc to suppress diff for EA
  entry, if state value is provided, but config value is
  not provided (e.g. in case of EA inheritance).

* Created acceptance test to validate that terraform
  provider won't try to remove EAs, that added by outside
  tool (e.g. NIOS in case of EA inheritance).

* Added test case for inherited network EA update

* In case, if inherited EA is specified in configuration,
  it should be overridden by terraform.

* Fixes nil pointer dereference panic in ip allocation

* Re-implemented inherited EA support

* Previous solution containing a diff suppress function
  had a problem with EA delete operations, since diff
  suppress function doesn't have the access to actual API
  object state.

* Now, inherited EAs are omitted on the read stage and
  added back on the update stage.

* Added two helper functions for serialization and
  deserialization EAs into/from JSON formatted string,
  which is usually used as a value of 'ext_attrs' fields.

* fixing the tests: part 1

* Added support for EA definition API resource

* This resource could be used for creating EA definition
  (e.g. in acceptance tests).

* Added EA inheritance support for network container

* Now inherited EAs won't be removed by terraform on a
  second apply step.

* fixing the tests: part 2

* fixing the tests: part 3, final

* Added support for EA search for record objects

* Fixes minor issue in TXT Record unit tests

* Fixed IP allocation tests

* Added EA inheritance support for network view resource

* Added DNS view terraform resource, small EA def refactoring

* `infoblox_zone_auth` resource implementation.
Based on b9fe7c2

* Implemented EA inheritance support for IP allocation object

* Added EA inheritance fix for record objects

* Updating vendor dir and dependencies of go-client

* Added Zone Auth datasource with EA search feature

* Added DNS View datasource feature and Import Functionality

* Removing EA definition resource part

* Added supported arguments for filters in docs

* Fixes EA's are imported as null in state

* Fixes EA inheritance issues for updating specified EAs and required EAs

* Updates vendor directory with Multi Value EASearch Fix

* Fixes Error Message is not handled while updating A, AAAA

* Fixes Multi-value search fails while user provide space in a comma

* Fixes Auth Zone fails to update with NSGroup Field

* Updates documentation with filters info and newly added objects

* Updated the list of resources and datasources in index

* Updated go-client new changes in dependencies

* Updates Datasource Example files

---------

Co-authored-by: Aleksei Chernevskii <aleksei_chernevskii@epam.com>
Co-authored-by: Sergey Kudriavtsev <skudriavtsev@infoblox.com>
  • Loading branch information
3 people authored Oct 18, 2023
1 parent 0e36596 commit 757dcea
Show file tree
Hide file tree
Showing 1,240 changed files with 94,765 additions and 207,222 deletions.
87 changes: 61 additions & 26 deletions docs/data-sources/infoblox_a_record.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,56 @@
# A-record Data Source

Use the `infoblox_a_record` data source to retrieve the following information for an A-record, which is managed by a NIOS server:
Use the `infoblox_a_record` data source to retrieve the following information for an A-Record if any, which is managed by a NIOS server:

* `dns_view`: the DNS view which the record's zone belongs to. Example: `default`
* `ip_addr`: the IPv4 address associated with the A-record. Example: `17.10.0.8`
* `fqdn`: the fully qualified domain name which the IP address is assigned to. `blues.test.com`
* `zone`: the zone that contains the record in the specified DNS view. Example: `test.com`.
* `ttl`: the "time to live" value of the record, in seconds. Example: `1800`.
* `comment`: the description of the record. This is a regular comment. Example: `Temporary A-record`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as a JSON map. Example: `{"Owner": "State Library", "Expires": "never"}`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"TestEA\":56,\"TestEA1\":\"kickoff\"}"`

To get information about an A-record, specify a combination of the DNS view, IPv4 address that the record points to, and the FQDN that corresponds to the IP address.
As there is new feature filters , the previous usage of combination of DNS view, IPv4 address and FQDN, has been removed.

The following list describes the parameters you must define in an `infoblox_a_record` data source block (all of them are required):
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.

* `dns_view`: optional, specifies the DNS view which the record's zone belongs to. If a value is not specified, the name `default` is used as the DNS view.
* `ip_addr`: the IPv4 address associated with the A-record.
* `fqdn`: the fully qualified domain name which the IP address is assigned to.
### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|----------|----------|--------|------------|
| name | fqdn | string | yes |
| view | dns_view | string | yes |
| zone | --- | string | yes |
| ttl | --- | uint | no |
| comment | --- | string | yes |
| ipv4addr | ip_addr | string | yes |

!> Any of the combination from searchable fields in supported arguments list for fields are allowed.

!> Please consider using only fields as the keys in terraform datasource filters, kindly don't use alias names as keys from the above table.

### Example for using the filters:
```hcl
data "infoblox_a_record" "a_rec_filter" {
filters = {
name = "testing.demo1.com"
view = "nondefault_dnsview" // associated DNS view
}
}
```

!> From the above example, if the 'view' alias 'dns_view' value is not specified, if same record exists in one or more different DNS views, those
all records will be fetched in results.

!> If `null` or empty filters are passed, then all the records or objects associated with datasource like here `infoblox_a_record` will be fetched in results.

### Example of an A-record Data Source Block

This example defines a data source of type `infoblox_a_record` and the name "vip_host", which is configured in a Terraform file.
You can reference this resource and retrieve information about it. For example, `data.infoblox_a_record.vip_host.comment` returns
a text as is a comment for the A-record.
This example defines a data source of type `infoblox_a_record` and the name "a_rec_temp", which is configured in a Terraform file.
You can reference this resource and retrieve information about it.

```hcl
resource "infoblox_a_record" "vip_host" {
Expand All @@ -34,33 +65,37 @@ resource "infoblox_a_record" "vip_host" {
}
data "infoblox_a_record" "vip_host" {
dns_view="nondefault_dnsview2"
fqdn="very-interesting-host.example.com"
ip_addr="10.3.1.65"
data "infoblox_a_record" "a_rec_temp" {
filters = {
name = "very-interesting-host.example.com"
ipv4addr = "10.3.1.65" //alias is ip_addr
view = "nondefault_dnsview2"
}
// 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" {
value = data.infoblox_a_record.vip_host.id
}
output "vip_host_zone" {
value = data.infoblox_a_record.vip_host.zone
output "a_rec_res" {
value = data.infoblox_a_record.a_rec_temp
}
output "vip_host_ttl" {
value = data.infoblox_a_record.vip_host.ttl
// accessing individual field in results
output "a_rec_name" {
value = data.infoblox_a_record.a_rec_temp.results.0.fqdn //zero represents index of json object from results list
}
output "vip_host_comment" {
value = data.infoblox_a_record.vip_host.comment
// accessing A-Record through EA's
data "infoblox_a_record" "a_rec_ea" {
filters = {
"*Site" = "some test site"
"*Location" = "65.8665701230204, -37.00791763398113"
}
}
output "vip_host_ext_attrs" {
value = data.infoblox_a_record.vip_host.ext_attrs
output "a_rec_out" {
value = data.infoblox_a_record.a_rec_ea
}
```

85 changes: 60 additions & 25 deletions docs/data-sources/infoblox_aaaa_record.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
# AAAA-record Data Source

Use the `infoblox_aaaa_record` data source to retrieve the following information for an AAAA-record, which is managed by a NIOS server:
Use the `infoblox_aaaa_record` data source to retrieve the following information for an AAAA-record if any, which is managed by a NIOS server:

* `dns_view`: the DNS view which the record's zone belongs to. Example: `nondefault_dnsview`
* `ipv6_addr`: the IPv6 address associated with the AAAA-record. Example: `2001::14`
* `fqdn`: the fully qualified domain name which the IP address is assigned to. Example: `foo1.test.com`
* `zone`: the zone that contains the record in the specified DNS view. Example: `test.com`.
* `ttl`: the "time to live" value of the record, in seconds. Example: `1800`.
* `comment`: the description of the record. This is a regular comment. Example: `Temporary AAAA-record`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as a JSON map. Example: `{"Owner": "State Library", "Expires": "never"}`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"TestEA\":56,\"TestEA1\":\"kickoff\"}"`.

To get information about an AAAA-record, specify a combination of the DNS view, IPv6 address that the record points to, and the FQDN that corresponds to the IP address.
As there is new feature filters , the previous usage of combination of DNS view, IPv6 address and FQDN, has been removed.

The following list describes the parameters you must define in an `infoblox_aaaa_record` data source block (all except `dns_view` are required):
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.

* `dns_view`: optional, specifies the DNS view which the record's zone belongs to. If a value is not specified, the name `default` is used as the DNS view.
* `ipv6_addr`: the IPv6 address associated with the AAAA-record.
* `fqdn`: the fully qualified domain name which the IP address is assigned to.
### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|----------|----------|--------|------------|
| name | fqdn | string | yes |
| view | dns_view | string | yes |
| zone | --- | string | yes |
| ttl | --- | uint | no |
| comment | --- | string | yes |
| ipv6addr | ip_addr | string | yes |

!> Any of the combination from searchable fields in supported arguments list for fields are allowed.

!> Please consider using only fields as the keys in terraform datasource filters, kindly don't use alias names as keys from the above table.

### Example for using the filters:
```hcl
data "infoblox_aaaa_record" "aaaa_rec_filter" {
filters = {
name = "debug.test.com"
ipv6addr = "2002::100"
view = "nondefault_dnsview" // associated DNS view
}
}
```

!> From the above example, if the 'view' alias 'dns_view' value is not specified, if same record exists in one or more different DNS views, those
all records will be fetched in results.

!> If `null` or empty filters are passed, then all the records or objects associated with datasource like here `infoblox_aaaa_record` will be fetched in results.

### Example of an AAAA-record Data Source Block

This example defines a data source of type `infoblox_aaaa_record` and the name "vip_host", which is configured in a Terraform file.
You can reference this resource and retrieve information about it. For example, `data.infoblox_aaaa_record.vip_host.comment` returns
a text as is a comment for the AAAA-record.
This example defines a data source of type `infoblox_aaaa_record` and the name "qa_rec_temp", which is configured in a Terraform file.
You can reference this resource and retrieve information about it.

```hcl
resource "infoblox_aaaa_record" "vip_host" {
Expand All @@ -32,32 +64,35 @@ resource "infoblox_aaaa_record" "vip_host" {
})
}
data "infoblox_aaaa_record" "vip_host" {
fqdn="very-interesting-host.example.com"
ipv6_addr="2a05:d014:275:cb00:ec0d:12e2:df27:aa60"
data "infoblox_aaaa_record" "qa_rec_temp" {
filters = {
name ="very-interesting-host.example.com"
ipv6addr ="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" {
value = data.infoblox_aaaa_record.vip_host.id
}
output "vip_host_zone" {
value = data.infoblox_aaaa_record.vip_host.zone
output "qa_rec_res" {
value = data.infoblox_aaaa_record.qa_rec_temp
}
output "vip_host_ttl" {
value = data.infoblox_aaaa_record.vip_host.ttl
// accessing ip addr field in results
output "qa_rec_addr" {
value = data.infoblox_aaaa_record.qa_rec_temp.results.0.ip_addr //zero represents index of json object from results list
}
output "vip_host_comment" {
value = data.infoblox_aaaa_record.vip_host.comment
// accessing AAAA-Record through EA's
data "infoblox_aaaa_record" "qa_rec_ea" {
filters = {
"*Site" = "sample test site"
"*Location" = "65.8665701230204, -37.00791763398113"
}
}
output "vip_host_ext_attrs" {
value = data.infoblox_aaaa_record.vip_host.ext_attrs
output "qa_rec_out" {
value = data.infoblox_aaaa_record.qa_rec_ea
}
```
80 changes: 61 additions & 19 deletions docs/data-sources/infoblox_cname_record.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,57 @@
# CNAME-record Data Source

Use the `infoblox_cname_record` data resource for the CNAME object to retrieve the following information for CNAME records:
Use the `infoblox_cname_record` data resource for the CNAME object to retrieve the following information for a CNAME record:

* `dns_view`: the DNS view which the record's zone belongs to. Example: `nondefault_dnsview`
* `canonical`: the canonical name of the record in the FQDN format. Example: `debug.point.somewhere.in`
* `alias`: the alias name of the record in the FQDN format. Example: `foo1.test.com`
* `zone`: the zone that contains the record in the specified DNS view. Example: `test.com`.
* `ttl`: the "time to live" value of the record, in seconds. Example: `3600`.
* `comment`: the text describing the record. This is a regular comment. Example: `Temporary CNAME-record`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as a JSON map. Example: `{"Owner”: "State Library”, "Expires”: "never”}`
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Owner\":\"State Library\",\"Expiry\":\"Never\"}"`

To get information about a CNAME-record, specify a combination of the DNS view, canonical name, and an alias that the record points to.
As there is new feature filters , the previous usage of combination of DNS view, alias and canonical name, has been removed.

The following list describes the parameters you must define in an `infoblox_cname_record` data source block (all of them are required):
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.

* `dns_view`: optional, specifies the DNS view which the record's zone belongs to. If a value is not specified, the name `default` is used as the DNS view.
* `canonical`: specifies the canonical name of the record in the FQDN format.
* `alias`: specifies the alias name of the record in the FQDN format.
### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|-----------|----------|--------|------------|
| name | alias | string | yes |
| view | dns_view | string | yes |
| canonical | --- | string | yes |
| ttl | --- | uint | no |
| comment | --- | string | yes |
| zone | --- | string | yes |

!> Any of the combination from searchable fields in supported arguments list for fields are allowed.

!> Please consider using only fields as the keys in terraform datasource filters, kindly don't use alias names as keys from the above table.

### Example for using the filters:
```hcl
data "infoblox_cname_record" "cname_rec_filter" {
filters = {
name = "testing.demo1.com"
canonical = "delivery.random.street.in"
}
}
```

!> From the above example, if the 'view' alias 'dns_view' value is not specified, if same record exists in one or more different DNS views, those
all records will be fetched in results.

!> If `null` or empty filters are passed, then all the records or objects associated with datasource like here `infoblox_cname_record`, will be fetched in results.

### Example of the CNAME-record Data Source Block

This example defines a data source of type `infoblox_cname_record` and the name "cname_rec", which is configured in a Terraform file.
You can reference this resource and retrieve information about it.

```hcl
resource "infoblox_cname_record" "foo" {
dns_view = "default.nondefault_netview"
Expand All @@ -30,29 +65,36 @@ resource "infoblox_cname_record" "foo" {
})
}
data "infoblox_cname_record" "foo"{
dns_view="default.nondefault_netview"
alias="foo.test.com"
canonical="main.test.com"
data "infoblox_cname_record" "cname_rec"{
filters = {
name = "foo.test.com"
canonical = "strange-place.somewhere.in.the.net"
view = "default.nondefault_netview"
}
// 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" {
value = data.infoblox_cname_record.foo.ttl
output "cname_rec_out" {
value = data.infoblox_cname_record.cname_rec
}
output "foo_zone" {
value = data.infoblox_cname_record.foo.zone
// accessing individual field in results
output "cname_rec_alias" {
value = data.infoblox_cname_record.cname_rec.results.0.alias //zero represents index of json object from results list
}
output "foo_comment" {
value = data.infoblox_cname_record.foo.comment
// accessing CNAME-Record through EA's
data "infoblox_cname_record" "cname_rec_ea" {
filters = {
"*Location" = "Cali"
}
}
output "foo_ext_attrs" {
value = data.infoblox_cname_record.foo.ext_attrs
// throws matching CNAME records with EA, if any
output "cname_rec_res" {
value = data.infoblox_cname_record.cname_rec_ea
}
```
Loading

0 comments on commit 757dcea

Please sign in to comment.