Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for the ForwardZone and upgraded Terraform and Go Lang version #373

Merged
merged 19 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
42926a0
Added data source for ipv6 network, ipv6 network container and host r…
JchhatbarInfoblox Jun 4, 2024
b9b9504
[FIX] Zone Auth setting NSGroup as None after importing (#351)
JkhatriInfobox Jun 4, 2024
d141d9e
Resource fwd zone (#352)
Aish-sp Jun 4, 2024
386467a
[FIX] NIOS-101148: adding support for forwadring_servers of forward-z…
Aish-sp Jun 7, 2024
4d9e1e0
Added support for mac, duid, enable_dhcp, enable_dns for host record …
JchhatbarInfoblox Jun 7, 2024
f7599bf
Fix | NIOS-101231 | Added enable dns to return fields. (#356)
JchhatbarInfoblox Jun 11, 2024
3bf2ae2
Support external ns group and updated Forward_TO with nullable struct…
JkhatriInfobox Jun 18, 2024
782aa2e
changing GetZoneForward parameter to queryParams (#360)
Aish-sp Jun 18, 2024
5acdea6
Bug fix npa-35 (#361)
JkhatriInfobox Jun 19, 2024
9bac9ae
Adding example for host record, ipv6 network and container. (#357)
JchhatbarInfoblox Jun 20, 2024
0ccde2c
Adding examples for resource and datasource for zone-forward (#362)
Aish-sp Jun 20, 2024
b4b98b1
add testcase for forwardzone resource and datasource (#366)
Aish-sp Jun 20, 2024
f5dc487
added EA search example for host record. (#369)
JchhatbarInfoblox Jun 20, 2024
ec51861
Added document for host record, IPv6 network and container. (#365)
JchhatbarInfoblox Jun 20, 2024
300c0c5
Update wapi version to 2.9 in provider and updated website and Git do…
JkhatriInfobox Jun 20, 2024
5568ef1
Update dependency with vendor dir (#372)
JkhatriInfobox Jun 20, 2024
93d2b9f
adding documentation for zone forward resource and datasource (#367)
Aish-sp Jun 20, 2024
a345df1
Updated changelog.md and readme.md for 2.7.0 release (#370)
JchhatbarInfoblox Jun 20, 2024
7f0a6ac
[FIX] CI RUN by chnaging Go Versio in workflow. (#374)
JkhatriInfobox Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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\":\"[email protected]\"}"`.

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
Loading