Skip to content

Commit

Permalink
Added support for the ForwardZone and upgraded Terraform and Go Lang …
Browse files Browse the repository at this point in the history
…version (#373)

---------

Co-authored-by: Jaykumar Chhatbar <45447272+JchhatbarInfoblox@users.noreply.github.com>
Co-authored-by: Aish-sp <163982471+Aish-sp@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 20, 2024
1 parent d9cc48b commit a345439
Show file tree
Hide file tree
Showing 1,668 changed files with 135,648 additions and 46,655 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
go: [1.17]
go: [1.21]
steps:

- uses: actions/setup-go@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.6
go-version: 1.21
-
name: Import GPG key
id: import_gpg
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17
1.21
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Changelog
## [v2.7.0](https://github.com/infobloxopen/terraform-provider-infoblox/tree/v2.7.0) (2024-06-20)
- New Feature: Added support for Import block.
- New Resources:
- infoblox_zone_forward
- New Datasources:
- infoblox_zone_forward
- infoblox_ipv6_network
- infoblox_ipv6_network_container
- infoblox_host_record

## [v2.6.0](https://github.com/infobloxopen/terraform-provider-infoblox/tree/v2.6.0) (2024-04-17)
- New Feature: Ability to manage drift through "Terraform Internal ID" Extensible Attributes in resources
Expand Down
4 changes: 2 additions & 2 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Working at code level requires you to set up the environment, clone the code, b
## Building the Binary from Source Code and Using it
Golang and Terraform installed in the system are basic requirements to build and test the plugin.

* Install and set up Golang version 1.17 or later from:
* Install and set up Golang version 1.21 or later from:
`https://golang.org/doc/install`
* Install Terraform CLI v0.14.x from:
* Install Terraform CLI v1.8.1+ from:
`https://www.terraform.io/downloads.html`
* Clone the repo and build it as follows:
```
Expand Down
11 changes: 7 additions & 4 deletions GETTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ Specify the plugin version in the .tf file as follows:
required_providers {
infoblox = {
source = "infobloxopen/infoblox"
version = ">= 2.6.0"
version = ">= 2.7.0"
}
}
}
provider "infoblox" {
# Configuration options
server = "nios_ip-addr"
username = "username"
password = "password"
}
```

Expand All @@ -34,10 +37,10 @@ Terraform installs the specified version of the plugin when a `terraform init` i
Refer to the official documentation for more information https://registry.terraform.io/providers/infobloxopen/infoblox/latest/docs .

## Building a Binary from the GitHub Source Code and Using it
Complete the follwing steps to build the binary:
* Install and set up Golang version 1.17 or later from:
Complete the following steps to build the binary:
* Install and set up Golang version 1.21 or later from:
`https://golang.org/doc/install`
* Install Terraform CLI v0.14.x from:
* Install Terraform CLI v1.8.1+ from:
`https://www.terraform.io/downloads.html`
* Clone the repo and build it as follows:
```
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This is a provider plug-in for Terraform to manage Infoblox NIOS (Network Identity Operating System) resources using Terraform infrastructure as code solutions.
The plug-in enables lifecycle management of Infoblox NIOS DDI resources.

The latest version of Infoblox provider is [v2.6.0](https://github.com/infobloxopen/terraform-provider-infoblox/releases/tag/v2.6.0)
The latest version of Infoblox provider is [v2.7.0](https://github.com/infobloxopen/terraform-provider-infoblox/releases/tag/v2.7.0)

## Provider Features

Expand All @@ -30,6 +30,7 @@ The provider plug-in has NIOS DDI resources represented as Terraform resources a
* Host record as a backend for the following operations:
* 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`)

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 @@ -50,6 +51,10 @@ DNS records and the `infoblox_ip_allocation` resources are supported with `ttl`
* TXT-record (`infoblox_txt_record`)
* SRV-record (`infoblox_srv_record`)
* Zone Auth (`infoblox_zone_auth`)
* Zone Forward (`infoblox_zone_forward`)
* IPv6 Network (`infoblox_ipv6_network`)
* IPv6 Network Container (`infoblox_ipv6_network_container`)
* Host-record (`infoblox_host_record`)

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 Expand Up @@ -111,8 +116,14 @@ The limitations of Infoblox IPAM Plug-In for Terraform are as follows:
are returned if you specify the name in the same text case. You must specify the name in lower case.
* In plug-in versions prior to `v2.5.0`, the fetch functionality in data sources returns output for only one matching
object even if it finds multiple objects matching the search criteria.
* 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.

## Best Practices

* Infoblox recommends that you manage all resources supported by IPAM Plug-In for Terraform from Terraform only. Modifying a resource outside of Terraform may result in unexpected behavior.
* If you need to manage a large number of resources, Infoblox recommends that you manage them across multiple workspaces instead of using a single state file to manage all resources. For more information, see [Managing Workspaces](https://developer.hashicorp.com/terraform/cli/workspaces) and [Structuring Terraform Configuration](https://www.hashicorp.com/blog/structuring-hashicorp-terraform-configuration-for-production).
* Infoblox recommends that you manage all resources supported by IPAM Plug-In for Terraform from Terraform only.
Modifying a resource outside of Terraform may result in unexpected behavior.
* If you need to manage a large number of resources, Infoblox recommends that you manage them across multiple workspaces
instead of using a single state file to manage all resources. For more information, see [Managing Workspaces](https://developer.hashicorp.com/terraform/cli/workspaces)
and [Structuring Terraform Configuration](https://www.hashicorp.com/blog/structuring-hashicorp-terraform-configuration-for-production).
102 changes: 102 additions & 0 deletions docs/data-sources/infoblox_host_record.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Host-record Data Source

Use the `infoblox_host_record` data source to retrieve the following information for a Host-Record if any, which is managed by a NIOS server:

* `dns_view`: the DNS view which the record's zone belongs to. Example: `default`
* `fqdn`: the fully qualified domain name which the IP address is assigned to. `blues.test.com`
* `ipv4_addr`: the IPv4 address associated with the Host-record. Example: `10.0.0.32`
* `ipv6_addr`: the IPv6 address associated with the Host-record. Example: `2001:1890:1959:2710::32`
* `mac_addr`: the MAC address associated with the Host-record. Example: `aa:bb:cc:dd:ee:11`
* `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`.
* `duid`: the DHCP Unique Identifier of the record. Example: `34:df:37:1a:d9:7f`.
* `enable_dns`: the flag to enable or disable the DNS record. Example: `true`.
* `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\"}"`

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.

The following table describes the parameters you can define in an `infoblox_host_record` data source block:

### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|--------------|--------------|--------|------------|
| name | fqdn | string | yes |
| view | dns_view | string | yes |
| network_view | network_view | string | yes |
| zone | zone | string | yes |
| comment | comment | string | yes |

!> 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_host_record" "host_rec_filter" {
filters = {
name = "host1.example.org"
}
}
```

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

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

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

```hcl
// This is just to ensure that the record has been be created
resource "infoblox_zone_auth" "zone1" {
fqdn = "example.org"
view = "default"
}
resource "infoblox_ip_allocation" "allocation1" {
dns_view = "default"
enable_dns = true
fqdn = "host1.example.org"
ipv4_addr = "10.10.0.7"
ipv6_addr = "1::1"
ext_attrs = jsonencode({"Location" = "USA"})
depends_on = [infoblox_zone_auth.zone1]
}
resource "infoblox_ip_association" "association1" {
internal_id = infoblox_ip_allocation.allocation1.id
mac_addr = "12:00:43:fe:9a:8c"
duid = "12:00:43:fe:9a:81"
enable_dhcp = false
depends_on = [infoblox_ip_allocation.allocation1]
}
data "infoblox_host_record" "host_rec_temp" {
filters = {
name = "host1.example.org"
}
// This is just to ensure that the record has been be created
// using 'infoblox_host_record' resource block before the data source will be queried.
depends_on = [infoblox_ip_association.association1]
}
// accessing Host-record through name
output "host_rec_res" {
value = data.infoblox_host_record.host_rec_temp
}
// fetching Host-Records through EAs
data "infoblox_host_record" "host_rec_ea" {
filters = {
"*Location" = "USA"
}
}
output "host_ea_out" {
value = data.infoblox_host_record.host_rec_ea
}
```

78 changes: 78 additions & 0 deletions docs/data-sources/infoblox_ipv6_network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# IPv6 Network Data Source

The data source for the network object allows you to get the following parameters for an IPv6 network resource:

* `network_view`: the network view which the network container exists in. Example: `nondefault_netview`
* `cidr`: the network block which corresponds to the network, in CIDR notation. Example: `2002:1f93:0:4::/96`
* `comment`: a description of the network. This is a regular comment. Example: `Untrusted network`.
* `ext_attrs`: The set of extensible attributes, if any. The content is formatted as string of JSON map. Example: `"{\"Owner\":\"State Library\",\"Administrator\":\"unknown\"}"`.


To retrieve information about IPv6 network 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.

The following table describes the parameters you can define in an `infoblox_ipv6_network` data source block:

### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|--------------|--------------|--------|------------|
| network | cidr | string | yes |
| network_view | network_view | string | yes |
| comment | comment | string | yes |

!> 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_ipv6_network" "readNet1" {
filters = {
network = "2002:1f93:0:4::/96"
network_view = "nondefault_netview"
}
depends_on = [infoblox_ipv6_network.ipv6net1]
}
```

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

### Example of a Network Data Source Block

```hcl
// This is just to ensure that the network has been be created
resource "infoblox_ipv6_network" "ipv6net1" {
cidr = "2002:1f93:0:4::/96"
reserve_ipv6 = 10
gateway = "2002:1f93:0:4::1"
comment = "let's try IPv6"
ext_attrs = jsonencode({
"Site" = "Antarctica"
})
}
data "infoblox_ipv6_network" "readNet1" {
filters = {
network = "2002:1f93:0:4::/96"
}
// using 'infoblox_ipv6_network' resource block before the data source will be queried.
depends_on = [infoblox_ipv6_network.ipv6net1]
}
// accessing IPv6 network through EA's
data "infoblox_ipv6_network" "readnet2" {
filters = {
"*Site" = "Antarctica"
}
depends_on = [infoblox_ipv6_network.ipv6net1]
}
// throws matching IPv6 network.
output "ipv6net_res" {
value = data.infoblox_ipv6_network.readNet1
}
// throws matching IPv4 networks with EA, if any
output "ipv6net_res1" {
value = data.infoblox_ipv6_network.readnet2
}
```
72 changes: 72 additions & 0 deletions docs/data-sources/infoblox_ipv6_network_container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# IPv6 Network Container Data Source

Use the data source to retrieve the following information for an IPv6 network container resource from the corresponding
object in NIOS:
* `network_view`: the network view which the network container exists in. Example: `nondefault_netview`
* `cidr`: the IPv6 network block of the network container. Example: `2002:1f93:0:2::/96`
* `comment`: a description of the network container. This is a regular comment. Example: `Tenant 1 network container`.
* `ext_attrs`: the set of extensible attributes of the network view, if any. The content is formatted as stirng of JSON map. Example: `"{\"Administrator\":\"jsw@telecom.ca\"}"`.

To retrieve information about Ipv6 network container 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.

The following table describes the parameters you can define in an `infoblox_ipv6_network_container` data source block:
### Supported Arguments for filters

-----
| Field | Alias | Type | Searchable |
|--------------|--------------|--------|------------|
| network | cidr | string | yes |
| network_view | network_view | string | yes |
| comment | comment | string | yes |

!> 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_ipv6_network_container" "nc_filter" {
filters = {
network = "2002:1f93:0:2::/96"
}
}
```

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

### Example of an IPv4 Network Container Data Source Block

```hcl
// This is just to ensure that the network container has been be created
resource "infoblox_ipv6_network_container" "nc1" {
cidr = "2002:1f93:0:2::/96"
comment = "new generation network segment"
ext_attrs = jsonencode({
"Site" = "space station"
})
}
data "infoblox_ipv6_network_container" "nc2" {
filters = {
network = "2002:1f93:0:2::/96"
}
// using 'infoblox_ipv6_network_container' resource block before the data source will be queried.
depends_on = [infoblox_ipv6_network_container.nc1]
}
data "infoblox_ipv6_network_container" "nc_ea_search" {
filters = {
"*Site" = "space station"
}
// using 'infoblox_ipv6_network_container' resource block before the data source will be queried.
depends_on = [infoblox_ipv6_network_container.nc1]
}
// accessing IPv6 network container through network block
output "nc1_output" {
value = data.infoblox_ipv6_network_container.nc2
}
// accessing IPv6 network container through EA's
output "nc1_comment" {
value = data.infoblox_ipv6_network_container.nc_ea_search
}
```
Loading

0 comments on commit a345439

Please sign in to comment.