Skip to content

Commit

Permalink
Dev2.8 (#415)
Browse files Browse the repository at this point in the history
* Added support for ZoneDelegated object (#379)

---------

Co-authored-by: Neil Garratt <[email protected]>
Co-authored-by: Piper Dougherty <[email protected]>

* Next available (#387)

* Implement next_available network support for NW and NW conatiner

* adding next_available_ip support for RecordAAAA and RecordHost in terraform

* adding support for next-available-ip for hostrecord and record:aaaa

* adding aliases field on host record (#388)

* A record implementation for next available ip (#385)

* Test cases for a record next-available-ip  (#391)

* test cases for a record and aaaa record

* test cases for aaaa record - next_available_ip

* validation if aliases have domain name suffix if dns is enabled and test cases for alias field (#392)

* test cases for a record and aaaa record

* test cases for aaaa record - next_available_ip

* validation if aliases have domain name suffix if dns is enabled and test cases for alias field

* aliases for ip association

* Fix for NPA-193 (#393)

* adding other fields for host-record (#394)

* adding other fields for host-record

* change next-available-ip function in recordA

* Host record after rebasing

* bugFix for hostRecord ip_addr_type and disable fields (#396)

* Fix for NPA-195  (#395)

* Fix for NPA-193

* Fix for NPA-195--->Added a function to handle leading zeros for IPV6

* handling leading zeros for cidr in network container

* Update resource_infoblox_ip_allocation.go

Added missing braces for statfunc

* NPA-199: fix- updating error message and ip_association_test file (#397)

* Npa 201 (#399)

* NPA-199: fix- updating error message and ip_association_test file

* NPA-201 fix: setting CIDR value while dynamic allocation of NW, NWC and updating documentation for filter_params fields and error msg for alias format

* removing disable field from AAAA record

* alias field added in datasource file (#400)

modified the test cases for host record
DiffSuppressFunc added to handle the plan difference between configuration file and state file

* test cases for host record and network container for next available IP (#398)

* test cases for host record and network container for next available IP

* revert the changes for cidr and added IPV6 test case for network container

* Fix for NPA-155 --> TypeSet in the schema for delegate_to field changed to TypeList (#402)

* NPA-205 fix: adding network_view in object_parameters map (#401)

* NPA-207 fix: adding disable field for host record datasource (#403)

* Fix for NPA-208 (#404)

* NPA-209 Fix: removing ipv4_addr and ipv6_addr fields from statefile for dynamic allocation using filter_params (#405)

* DiffSupress function changes for alias field in host record when dns is disabled  (#406)

* DiffSupress function changes for alias field in host record when dns is disabled

* Updating ttl value : ttl value being de-referenced in the assoication when its nil

* Npa 200 fix: Deleting aliases field when DNS is enabled (#408)

* updating documentation and adding examples for next-available and zone-delegated

* NPA-200 fix: deleting aliases when dns is enabled

* NPA-211 Fix: adding IPV4 as default value for ip_address_type (#409)

* formatting examples for next-available and zone-delegated (#410)

* not setting ip_address_type and object fields when filter_params is not used (#413)

* setting ip_addr_type, object fields to null during import and disable fields. (#414)

* setting ip_addr_type, object fields to null during import and disable field during import and read

* adding error check for d.set

* updating docs folder and ReadME for zone-delegated and next-available (#412)

* updating docs folder and ReadME for zone-delegated and next-available

* updating review comments for documentation

* removing default values for data source example

* Updated vendor directory (#416)

* correction for the typo in error message for A  record (#411)

---------

Co-authored-by: Aish-sp <[email protected]>
Co-authored-by: Neil Garratt <[email protected]>
Co-authored-by: Piper Dougherty <[email protected]>
Co-authored-by: Chaithra <[email protected]>
  • Loading branch information
5 people authored Oct 30, 2024
1 parent 05ca000 commit ec4b1ea
Show file tree
Hide file tree
Showing 233 changed files with 30,847 additions and 4,298 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The provider plug-in has NIOS DDI resources represented as Terraform resources a
* Allocation and deallocation of an IP address from a Network (`infoblox_ip_allocation`)
* Association and disassociation of an IP address from a VM (`infoblox_ip_association`)
* Zone Forward (`infoblox_zone_forward`)
* Zone Delegated (`infoblox_zone_delegated`)

All of the above resources are supported with `comment` and `ext_attrs` fields.
DNS records and the `infoblox_ip_allocation` resources are supported with `ttl` field.
Expand All @@ -55,6 +56,7 @@ DNS records and the `infoblox_ip_allocation` resources are supported with `ttl`
* IPv6 Network (`infoblox_ipv6_network`)
* IPv6 Network Container (`infoblox_ipv6_network_container`)
* Host-record (`infoblox_host_record`)
* Zone Delegated (`infoblox_zone_delegated`)

All of the above data sources are supported with `comment` and `ext_attr` fields.
Data source of DNS records are supported with `ttl` and `zone` fields.
Expand Down
2 changes: 2 additions & 0 deletions docs/data-sources/infoblox_host_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Use the `infoblox_host_record` data source to retrieve the following information
* `enable_dhcp`: the flag to enable or disable the DHCP record. Example: `true`.
* `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 string of JSON map. Example: `"{\"TestEA\":56,\"TestEA1\":\"kickoff\"}"`
* `disable`: the flag that specifies whether the record is disabled. Example: `false`.
* `aliases`: the list of aliases associated with the Host-record. Example: `["alias1.test.com", "alias2.test.com"]`.

To retrieve information about host records that match the specified filters, use the `filters` argument and specify the parameters mentioned in the below table. These are the searchable parameters of the corresponding object in Infoblox NIOS WAPI. If you do not specify any parameter, the data source retrieves information about all host records in the NIOS Grid.

Expand Down
111 changes: 111 additions & 0 deletions docs/data-sources/infoblox_zone_delegated.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Zone Delegated Data Source

Use the `infoblox_zone_delegated` data source to retrieve the following information about a delegated DNS zone from the corresponding object in NIOS:

* `fqdn`: The name of this DNS zone. For a reverse zone, this is in “address/cidr” format. Example: `11.10.0.0/24`. For other zones, this is in FQDN format. Example: `demozone.com` This value can be in unicode format.
* `view`: The name of the DNS view in which the zone resides. Example: `external`.
* `comment`: The Description of Delegated Zone Object. Example: `random delegated zone`.
* `ext_attrs`: The set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Location\":\"unknown\",\"TestEA\":\"ZoneTesting\"}"`.
* `zone_format`: Determines the format of corresponding zone. Valid values are `FORWARD`, `IPV4` and `IPV6`.
* `ns_group`: Specifies the name server group that serves DNS for this zone. Example: `demoGroup`.
* `disable`: Specifies whether the zone is disabled.
* `locked`: The flag that restricts other administrators from making any changes. Note that this flag is for administration purposes only. The zone will continue to serve DNS data even when it is locked. Example: `false`.
* `delegated_ttl`: The TTL value for the delegated zone. Example: `60`.
* `delegate_to`: The remote server to which the NIOS appliance redirects queries for data for the delegated zone. Example:
```terraform
delegate_to {
name = "te32.dz.ex.com"
address = "10.0.0.1"
}
```

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `fqdn`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retrieving the matching records.

### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|-------------|-------------|--------|------------|
| fqdn | fqdn | string | yes |
| view | view | string | yes |
| zone_format | zone_format | string | yes |
| comment | comment | string | yes |


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

!> "Aliases are the parameter names used in the prior releases of Infoblox IPAM Plug-In for Terraform. Do not use the alias names for parameters in the data source blocks. Using them can result in error scenarios."

### Example for using the filters:
```hcl
data "infoblox_zone_delegated" "data_zone_delegated" {
filters = {
fqdn = "zone_delegated.ex.org"
view = "default"
}
}
```
!> From the above example, if the 'view' value is not specified, if same zone name exists in one or more different DNS views, those
all zones will be fetched in results.

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

### Example of the Zone Delegated Data Source Block

```hcl
resource "infoblox_zone_delegated" "delegatedzone_delegateTo" {
fqdn = "zone_delegated.ex.org"
delegate_to {
name = "test22.dz.ex.com"
address = "10.0.0.1"
}
delegate_to {
name = "test2.dz.ex.com"
address = "10.0.0.2"
}
ext_attrs = jsonencode({
"Site" = "Antarctica"
})
}
// accessing Zone Delegated by specifying fqdn, view and extra attribute Site
data "infoblox_zone_delegated" "data_zone_delegated" {
filters = {
fqdn = "zone_delegated.ex.org"
view = "default"
"*Site" = "Antarctica"
}
// This is just to ensure that the record has been be created
depends_on = [infoblox_zone_delegated.delegatedzone_delegateTo]
}
// returns matching Zone Delegated with fqdn and view, if any
output "zone_delegated_data3" {
value = data.infoblox_zone_delegated.data_zone_delegated
}
resource "infoblox_zone_delegated" "delegatedzone_IPV4_nsGroup" {
fqdn = "195.1.0.0/24"
comment = "Delegated zone IPV4"
zone_format = "IPV4"
ns_group = "test"
}
// accessing Zone Delegated by specifying fqdn, view and comment
data "infoblox_zone_delegated" "datazone_delegated_fqdn_view_comment" {
filters = {
fqdn = "195.1.0.0/24"
view = "default"
comment = "Delegated zone IPV4"
}
// This is just to ensure that the record has been be created
depends_on = [infoblox_zone_delegated.delegatedzone_IPV4_nsGroup]
}
// returns matching Zone Delegated with fqdn, view and comment, if any
output "zone_delegated_data4" {
value = data.infoblox_zone_delegated.datazone_delegated_fqdn_view_comment
}
```
3 changes: 1 addition & 2 deletions docs/data-sources/infoblox_zone_forward.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ Use the `infoblox_zone_forward` data source to retrieve the following informatio

* `fqdn`: The name of this DNS zone. For a reverse zone, this is in “address/cidr” format. Example: `11.10.0.0/24`. For other zones, this is in FQDN format. Example: `demozone.com` This value can be in unicode format.
* `view`: The name of the DNS view in which the zone resides. Example: `external`.
* `zone_format`: Determines the format of corresponding zone. Valid values are `FORWARD`, `IPV4` and `IPV6`.
* `comment`: The Description of Forward Zone Object. Example: `random forward zone`.
* `ext_attrs`: The set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Location\":\"unknown\",\"TestEA\":\"ZoneTesting\"}"`.
* `zone_format`: Determines the format of corresponding zone. Valid values are `FORWARD`, `IPV4` and `IPV6`. Default value: `FORWARD`.
* `zone_format`: Determines the format of corresponding zone. Valid values are `FORWARD`, `IPV4` and `IPV6`.
* `ns_group`: Specifies the name server group that serves DNS for this zone. Example: `demoGrp`.
* `external_ns_group`: Specifies the name of the forward stub server. Example: `stubGroup`.
* `disable`: Specifies whether the zone is disabled. Default value: `false`.
Expand Down
20 changes: 11 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ curl -k -u <user>:<password> -H "Content-Type: application/json" -X POST https:/

> **Note:**
>
>Either the Terraform Internal ID extensible attribute definition must be present in NIOS or IPAM Plug-In for Terraform
>Either the Terraform Internal ID extensible attribute definition must be present in NIOS or IPAM Plug-In for Terraform
must be configured with superuser access for it to automatically create the extensible attribute. If not, the connection
to Terraform will fail.
to Terraform will fail.
>
>If you choose to create the Terraform Internal ID extensible attribute manually or by using the cURL command,
the creation of the extensible attribute is not managed by IPAM Plug-In for Terraform.
>
>You must not modify the Terraform Internal ID for a resource under any circumstances. If it is modified, the resource
will no longer be managed by Terraform.
will no longer be managed by Terraform.


## Configuring Infoblox Terraform IPAM Plug-In
Expand Down Expand Up @@ -101,6 +101,7 @@ There are resources for the following objects, supported by the plugin:
* Zone Auth (`infoblox_zone_auth`)
* Zone Forward (`infoblox_zone_forward`)
* Host record (`infoblox_ip_allocation` / `infoblox_ip_association`)
* Zone Delegated (`infoblox_zone_delegated`)

Network and network container resources have two versions: IPv4 and IPv6. In
addition, there are two operations which are implemented as resources:
Expand Down Expand Up @@ -152,12 +153,13 @@ There are data sources for the following objects:
* Zone Auth (`infoblox_zone_auth`)
* Zone Forward (`infoblox_zone_forward`)
* Host Record (`infoblox_host_record`)
* Zone Delegated (`infoblox_zone_delegated`)

!> From version 2.5.0, new feature filters are introduced. Now the data sources support to populate more than one
matching NIOS objects.

* `filters`: the schema, with passing combination of searchable fields are supported by NIOS server, which
returns one or more matching objects from the NIOS server.
returns one or more matching objects from the NIOS server.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.

Expand Down Expand Up @@ -265,11 +267,11 @@ with a randomly generated value in the form of a UUID to the record.
- You may use the command-line tool `uuid` for Linux-based systems to generate a UUID.

> The `Terraform Internal ID` extensible attribute is not shown in to terraform.tfstate file. Use it to create
or import the `infoblox_ip_allocation` and `infoblox_ip_association` resources.
You must not add it in a resource block with other extensible attributes.
or import the `infoblox_ip_allocation` and `infoblox_ip_association` resources.
You must not add it in a resource block with other extensible attributes.

> You must not delete (ex. with 'terraform destroy' command) an `infoblox_ip_association` resource right after importing, but you may do this after 'terraform apply'.
The reason: after 'terraform import' the dependency between `infoblox_ip_association` and respective `infoblox_ip_allocation` is not established by Terraform.
The reason: after 'terraform import' the dependency between `infoblox_ip_association` and respective `infoblox_ip_allocation` is not established by Terraform.


### Utilizing the Import Block to Import Resources:
Expand Down Expand Up @@ -311,5 +313,5 @@ resource "infoblox_a_record" "imported_records" {
}
```
> **Note:**
>
> When using the Terraform import block for a resource, a new Terraform internal ID is assigned to the resource when the terraform plan command is run for the first time. If a subsequent terraform apply is aborted, the record will still retain the Terraform Internal ID though the resource is not managed by Terraform.
>
> When using the Terraform import block for a resource, a new Terraform internal ID is assigned to the resource when the terraform plan command is run for the first time. If a subsequent terraform apply is aborted, the record will still retain the Terraform Internal ID though the resource is not managed by Terraform.
15 changes: 14 additions & 1 deletion docs/resources/infoblox_a_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The following list describes the parameters you can define in the resource block
* For allocating a static IP address, specify a valid IP address.
* For allocating a dynamic IP address, configure the `cidr` field instead of `ip_addr` . Optionally, specify a `network_view` if you do not want to allocate it in the network view `default`.
* `cidr`: required only for dynamic allocation, specifies the network from which to allocate an IP address when the `ip_addr` field is empty. The address is in CIDR format. For static allocation, use `ip_addr` instead of `cidr`. Example: `192.168.10.4/30`.
* `filter_params`: required only if `ip_addr` and `cidr` are not set, specifies the extensible attributes of the parent network that must be used as filters to retrieve the next available IP address for creating the record object. Example: `jsonencode({"*Site": "Turkey"})`.

!> To use upper case letters in `fqdn`, infoblox recommends that you use lower() function. Example: `lower("testEXAMPLE.zone1.com")`

Expand Down Expand Up @@ -48,4 +49,16 @@ resource "infoblox_a_record" "a_rec3" {
ttl = 0 // 0 = disable caching
ext_attrs = jsonencode({})
}
```
// dynamic A-record with filter_params
resource "infoblox_a_record" "rec"{
fqdn = "very-interesting-host.example.com"
ext_attrs = jsonencode({
"Location" = "65.8665701230204, -37.00791763398113"
})
filter_params = jsonencode({
"*Site": "Turkey"
})
comment = "A record"
}
```
14 changes: 14 additions & 0 deletions docs/resources/infoblox_aaaa_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The following list describes the parameters you can define in the resource block
* For allocating a static IP address, specify a valid IP address.
* For allocating a dynamic IP address, configure the `cidr` field instead of `ipv6_addr` . Optionally, specify a `network_view` if you do not want to allocate it in the network view `default`.
* `cidr`: required only for dynamic allocation, specifies the network from which to allocate an IP address when the `ipv6_addr` field is empty. The address is in CIDR format. For static allocation, use `ipv6_addr` instead of `cidr`. Example: `2001::/64`.
* `filter_params`: Required only if `ipv6_addr` and `cidr` are not set, specifies the extensible attributes of the parent network that must be used as filters to retrieve the next available IP address for creating the record object. Example: `jsonencode({"*Site": "Turkey"})`.

!> To use upper case letters in `fqdn`, infoblox recommends that you use lower() function. Example: `lower("testEXAMPLE.zone1.com")`

Expand Down Expand Up @@ -48,4 +49,17 @@ resource "infoblox_aaaa_record" "aaaa_rec3" {
ttl = 0 // 0 = disable caching
ext_attrs = jsonencode({})
}
// dynamic AAAA-record with filter_params
resource "infoblox_aaaa_record" "aaaa_rec3" {
fqdn = "dyn1.test.com"
comment = "example dynamic AAAA-record aaaa_rec3, updated"
ttl = 60
ext_attrs = jsonencode({
"Location" = "65.8665701230204, -37.00791763398113"
})
filter_params = jsonencode({
"*Site": "Turkey"
})
}
```
19 changes: 19 additions & 0 deletions docs/resources/infoblox_ip_allocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ The following list describes the parameters you can define in the `infoblox_ip_a
Use this parameter only when `ipv6_cidr` is not specified. The allocated IP address will be marked as ‘Used’ in NIOS Grid Manager.
The default value is an empty string. If you specify both `ipv6_addr` and `ipv6_cidr`, then the `ipv6_addr` address is allocated and `ipv6_cidr` is ignored.
Example: `2000:1148::10`.
* `filter_params`: required for dynamic allocation only if `ipv4_addr`, `ipv4_cidr`, `ipv6_addr` and `ipv6_cidr` are not set, specifies the extensible attributes of the parent network that must be used as filters to retrieve the next available IP address for creating the host record object.
The content is formatted as a string of a JSON map. Example: `jsonencode({"*Site": "Turkey"})`.
* `ip_address_type`: required only when filter_params is used, Specifies the type of IP address to allocate. The valid values are, `IPV4`, `IPV6`, and `Both`. The default value is `IPv4`.
* `ttl`: optional, specifies the 'time to live' value for the DNS record. This parameter is relevant only when `enable_dns` is set to `true`.
If a value is not specified, then in NIOS, the value is inherited from the parent zone of the DNS records for this resource. Example: `3600`.
* `disable`: optional,specifies whether the record disabled or not. The default value is `false`. Example: `true`.
* `comment`: optional, specifies the human-readable description of the resource. Example: `Front-end cloud node`.
* `aliases`: optional, specifies the list of aliases for the host record. Example: `["alias1", "alias2"]`.
* `ext_attrs`: optional, specifies the set of NIOS extensible attributes that are attached to the NIOS resource.
An extensible attribute must be a JSON map translated into a string value. Example:
```
Expand Down Expand Up @@ -168,4 +173,18 @@ resource "infoblox_ip_allocation" "allocation5" {
ipv6_cidr = infoblox_ipv6_network.net2.cidr
ipv4_cidr = infoblox_ipv4_network.net2.cidr
}
// dynamic allocation of both IPv4 and IPv6 host records using filter_params with aliases
resource "infoblox_ip_allocation" "rec_host17" {
fqdn = "new777.test.com"
aliases = ["www.test.com"]
disable = false
//Extensible attributes of parent network
filter_params = jsonencode({
"*Site": "Turkey"
})
ip_address_type = "Both"
enable_dns = true
ttl = 60
}
```
19 changes: 19 additions & 0 deletions docs/resources/infoblox_ipv4_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ The following list describes the parameters you can define in a `infoblox_ipv4_n
* `gateway`: optional, defines the IP address of the gateway within the network block. If a value is not set, the first IP address of the allocated network is assigned as the gateway address. If the value of the gateway parameter is set as `none`, no value is assigned.
* `ext_attrs`: optional, specifies the set of NIOS extensible attributes that will be attached to the network.
* `reserve_ip`: optional, specifies the number of IPv4 addresses that you want to reserve in the IPv4 network. The default value is 0
* `filter_params`: optional, specifies the extensible attributes of the parent network or network container that must be used as filters to retrieve the next available network for creating the network object. Example: `jsonencode({"*Site": "Turkey"})`.
* `object`: optional, specifies the type of object from which to allocate the network. The values can be `network` or `networkcontainer`. The default value is `networkcontainer`.

!> Once a network object is created, the `reserve_ip` and `gateway` fields cannot be edited.

!> IP addresses that are reserved by setting the `reserve_ip` field are used for network maintenance by the cloud providers. Therefore, Infoblox does not recommend using these IP addresses for other purposes.

!> The object parameter is applicable only if filter_params is configured.
!> If the object parameter is set to network, after the creation of the network object, the parent network object will be converted to a network container object.

### Examples of an IPv4 Network Block

```hcl
Expand Down Expand Up @@ -50,4 +55,18 @@ resource "infoblox_ipv4_network" "net3" {
"Site" = "any place you wish ..."
})
}
// full set of parameters for dynamically allocated IPv4 network using next-available
resource "infoblox_ipv4_network" "ipv4network1" {
allocate_prefix_len = 26
network_view = "nondefault_netview"
comment = "IPV4 NW within a NW container"
filter_params = jsonencode({
"*Site": "Blr"
})
ext_attrs = jsonencode({
"Site" = "UK"
})
object = "networkcontainer"
}
```
Loading

0 comments on commit ec4b1ea

Please sign in to comment.