Skip to content

Commit 1e76d7a

Browse files
authored
Updated Documentation for Terraform Provider (#233)
1 parent 5ceaeed commit 1e76d7a

File tree

11 files changed

+499
-156
lines changed

11 files changed

+499
-156
lines changed

README.md

Lines changed: 61 additions & 152 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/hashicorp/terraform-plugin-go v0.29.0
1313
github.com/hashicorp/terraform-plugin-log v0.9.0
1414
github.com/hashicorp/terraform-plugin-testing v1.13.3
15-
github.com/infobloxopen/infoblox-nios-go-client v0.0.2-0.20251028115152-d9664b8ab43b
15+
github.com/infobloxopen/infoblox-nios-go-client v0.0.2-0.20251029050158-dd1440a5a928
1616
golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc
1717
)
1818

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
133133
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
134134
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
135135
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
136-
github.com/infobloxopen/infoblox-nios-go-client v0.0.2-0.20251028115152-d9664b8ab43b h1:amIWRa47pByeK9xd0JWOnPFzTcxpSjQOHxP+Tf/d/b0=
137-
github.com/infobloxopen/infoblox-nios-go-client v0.0.2-0.20251028115152-d9664b8ab43b/go.mod h1:vpxFtcIME+BZrAAdFZAQ5sAIJUC+2bBPWbJUzI3MisA=
136+
github.com/infobloxopen/infoblox-nios-go-client v0.0.2-0.20251029050158-dd1440a5a928 h1:RDhixrIHY11IAUvad7p2wewmNHO2+hMxKdAyq7Id4ls=
137+
github.com/infobloxopen/infoblox-nios-go-client v0.0.2-0.20251029050158-dd1440a5a928/go.mod h1:vpxFtcIME+BZrAAdFZAQ5sAIJUC+2bBPWbJUzI3MisA=
138138
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
139139
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
140140
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=

guides/documentation_details.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Documentation
2+
3+
Detailed documentation for each resource and data source, including all supported attributes and their descriptions, is available in the `docs` directory of this repository:
4+
5+
- Resource documentation: `docs/resources/`
6+
- Data source documentation: `docs/data-sources/`
7+
8+
Each documentation file contains comprehensive information about:
9+
- Required and optional attributes
10+
- Computed attributes returned by the API
11+
- Examples of usage
12+
13+
We recommend referring to these documentation files for the most up-to-date and detailed information about working with specific NIOS objects.
14+
15+
For additional reference, navigate between the [Infoblox NIOS documentation](https://docs.infoblox.com/space/NIOS) (PDF only) and the WAPI documentation (accessible from the NIOS grid).
16+
17+
Alternatively, you can also refer to the [Infoblox NIOS Swagger](https://infobloxopen.github.io/nios-swagger/) to view the API endpoints and their parameters.

guides/importing_resources.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Importing Existing Resources
2+
3+
Resources can be imported using their reference ID:
4+
5+
```bash
6+
terraform import nios_dns_record_a.example record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmV4YW1wbGUsc2FtcGxlLDE5Mi4xNjguMS4xMA:example.mydomain.com/default
7+
```
8+
9+
You can use Terraform's import blocks (available in Terraform 1.5.0 and later) to declaratively import resources:
10+
11+
```hcl
12+
import {
13+
to = nios_dns_record_a.example
14+
id = "record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmV4YW1wbGUsc2FtcGxlLDE5Mi4xNjguMS4xMA:example.mydomain.com/default"
15+
}
16+
17+
resource "nios_dns_record_a" "example" {
18+
# Configuration will be imported from the ID
19+
# After import, update the configuration as needed
20+
}
21+
```
22+
23+
After running `terraform plan` and `terraform apply`, the resource will be imported and you can then update the configuration as needed.
24+
25+
You can generate a plan config and then use it to import a resource. This is in beta version and is supported in terraform version 1.7.0 or later.
26+
Below is the command to generate the same.
27+
28+
```
29+
terraform plan -generate-config-out=generated.tf
30+
```
31+
32+
Once the config is generated you can execute the `terraform apply` command to import the resource and you can then update the configuration as needed.
33+
34+
Refer the terraform link [here](https://developer.hashicorp.com/terraform/language/v1.14.x/import/generating-configuration).
35+
36+
37+
> **Note**:
38+
When using the import block, terraform plan triggers an update call to reconcile the resource state. During this update, Terraform adds the Extensible Attribute Terraform Internal ID to the resource.

guides/known_issues.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Terraform Known Issues
2+
3+
- Password attribute values for all objects should not be stored in plaintext format within the terraform.tfstate file.
4+
- FQDN validation needs to be added for multiple objects.
5+
- Unable to unset `cloud_info` field in terraform objects.
6+
- Admin Group:
7+
- password_setting cannot be updated when use_password_setting is unset under Admin Group.
8+
- Not able to set disable_all and enable_all under admin_set_commands in Admin Group.
9+
- Unable to Set/Unset many flags.
10+
- Host Record:
11+
- Unable to add authentication_password and privacy_password under snmp3_credential in the host record.
12+
- Cleanup of ipv4addrs and ipv6addrs sub-fields in doc as these are not accessible.
13+
- Certificate Authentication Service:
14+
- File Uploading for objects like CA Auth Service take place in Update Calls even if file path is not updated.
15+
- VDiscovery Task:
16+
- Need handle proper error message while creating openstack_vdiscoverytask with wrong HTTPS port.
17+
- Cannot perform search via service_account_file_token and cdiscovery_file_token although wapi mentions them to be searchable fields.
18+
- CAA Record:
19+
- EAs added via backend cannot be erased when Config does NOT have EA block.
20+
- Alias Record:
21+
- Cannot create Alias Record of type CAA through API but operation is supported on UI.
22+

guides/limitations.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Terraform limitations
2+
3+
Below are the limitations:
4+
5+
- Extensible Attribute definitions(extensibleattributedef):
6+
- Unable to set G flag in EA.
7+
- AWS Route 53 Task Groups(aws_route53_task_group):
8+
- It is possible to set the ARN value from Terraform for the nios_cloud_aws_route53_task_group object even when syn_child_account is set to false.
9+
- IPv6 Network(ipv6network):
10+
- Few fields can't be present when template field is present
11+
- Response Policy Zones(zone_rp):
12+
- Need to support rpz_type = "FEED" while creating a nios_dns_zone_rp resource.
13+
- Authoritative Zone(zone_auth):
14+
- Discrepancy with state of dnssec_key_params under Zone auth with each terraform apply.

guides/logging_debugging.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Terraform Logging
2+
3+
Terraform has detailed logs that can help debug provider issues. To enable them, set the `TF_LOG` environment variable to one of the log levels: `TRACE`, `DEBUG`, `INFO`, `WARN`, or `ERROR`:
4+
5+
```bash
6+
# For Linux/macOS
7+
export TF_LOG=DEBUG
8+
terraform plan
9+
10+
# For Windows PowerShell
11+
$env:TF_LOG="DEBUG"
12+
terraform plan
13+
```
14+
15+
The `TRACE` level is the most verbose and will include all API calls made by the provider to the Infoblox NIOS WAPI.
16+
17+
### Provider-Specific Debugging
18+
19+
For debugging specific issues with the NIOS provider:
20+
21+
1. Use `DEBUG` or `TRACE` log levels to see the API requests and responses
22+
2. Check the request body and response status codes for API errors
23+
3. Verify the WAPI version compatibility with your NIOS Grid Manager
24+
4. Ensure correct credentials and permissions in the NIOS system
25+
26+
For more information on debugging Terraform providers, refer to the [Terraform debugging documentation](https://developer.hashicorp.com/terraform/internals/debugging).

guides/quickstart.md

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
---
2+
page_title: "Managing DDI services with the NIOS Terraform Provider"
3+
subcategory: "Guides"
4+
description: |-
5+
This guide provides step-by-step instructions for using the NIOS Terraform Provider to manage DDI resources.
6+
---
7+
8+
# Managing DDI services with the NIOS Terraform Provider
9+
10+
This guide provides step-by-step instructions for using the NIOS Terraform Provider to manage DDI resources.
11+
12+
## Configuring the Provider
13+
14+
Before getting started, ensure you have completed the [prerequisites](../README.md#prerequisites).
15+
16+
The provider needs to be configured with a `NIOSHostURL`, `NIOSUsername` and `NIOSPassword`.
17+
18+
Create a directory for the Terraform configuration and create a file named `main.tf` with the following content:
19+
20+
````terraform
21+
terraform {
22+
required_providers {
23+
nios = {
24+
source = "infobloxopen/nios"
25+
version = ">= 0.0.1"
26+
}
27+
}
28+
required_version = ">= 1.8.0"
29+
}
30+
31+
provider "nios" {
32+
nios_host_url = "<NIOS_HOST_URL>"
33+
nios_username = "<NIOS_USERNAME>"
34+
nios_password = "<NIOS_PASSWORD>"
35+
}
36+
````
37+
38+
> ⚠️ **Warning**: Hard-coded credentials are not recommended in any configuration file. It is recommended to use environment variables.
39+
40+
You can also use the following environment variables to configure the provider: NIOS_HOST_URL, NIOS_USERNAME and NIOS_PASSWORD.
41+
42+
Initialize the provider by running the following command. This will download the provider and initialize the working directory.
43+
44+
45+
```shell
46+
terraform init
47+
```
48+
49+
## Configuring Resources
50+
51+
This section demonstrates how to create and manage resources using the NIOS Terraform provider.
52+
53+
### DNS Resources
54+
55+
### Authoritative Zone
56+
57+
In this example, you will use the following resources to create an authoritative zone.
58+
59+
- [nios_dns_zone_auth](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs/resources/nios_dns_zone_auth)
60+
61+
Add the following to the `main.tf` file:
62+
63+
````terraform
64+
// Create a DNS zone for the domain
65+
resource "nios_dns_zone_auth" "create_zone_auth" {
66+
fqdn = "exampledomain.com"
67+
extattrs = {
68+
Site = "location-1"
69+
}
70+
}
71+
````
72+
73+
Here the `view` attribute has not been set, so the default view will be used.
74+
75+
### DNS Records
76+
Further, you will create an A record and a CNAME record within the zone.
77+
78+
You will use the following resources to create these
79+
- [nios_dns_record_a](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs/resources/nios_dns_record_a)
80+
- [nios_dns_record_cname](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs/resources/nios_dns_record_cname)
81+
82+
Add the following code to your main.tf:
83+
84+
````terraform
85+
// Create an A record
86+
resource "nios_dns_record_a" "create_record_a" {
87+
name = "a_record.${nios_dns_zone_auth.create_zone_auth.fqdn}"
88+
ipv4addr = "10.0.0.10"
89+
view = "default"
90+
// Extensible Attributes
91+
extattrs = {
92+
Site = "location-1"
93+
}
94+
}
95+
96+
// Create a CNAME record
97+
resource "nios_dns_record_cname" "create_record_cname" {
98+
name = "cname_record.${nios_dns_zone_auth.create_zone_auth.fqdn}"
99+
canonical = "example-canonical-name.${nios_dns_zone_auth.create_zone_auth.fqdn}"
100+
depends_on = [nios_dns_zone_auth.create_zone_auth]
101+
}
102+
````
103+
104+
## IPAM Resources
105+
In this example, you will use the following resources to create a Network View and a Network
106+
107+
- [nios_ipam_network_view](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs/resources/nios_ipam_network_view)
108+
- [nios_ipam_network](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs/resources/nios_ipam_network)
109+
110+
Add the following to your main.tf:
111+
112+
````terraform
113+
//Create a Network View
114+
resource "nios_ipam_network_view" "create_network_view" {
115+
name = "example_network_view"
116+
}
117+
118+
// Create an IPV4 Network
119+
resource "nios_ipam_network" "create_network" {
120+
network = "15.0.0.0/24"
121+
network_view = "example_network_view"
122+
comment = "Created by Terraform"
123+
extattrs = {
124+
"Site" = "location-1"
125+
}
126+
}
127+
````
128+
129+
## DHCP Resources
130+
In this example, you will use the following resources to create a Fixed Address within the Network created above.
131+
132+
- [nios_dhcp_fixed_address](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs/resources/nios_dhcp_fixed_address)
133+
134+
Add the following to your main.tf:
135+
136+
````terraform
137+
//Create a fixed address within the above network
138+
resource "nios_dhcp_fixed_address" "create_fixed_address" {
139+
ipv4addr = "15.0.0.10"
140+
match_client = "MAC_ADDRESS"
141+
mac = "00:1a:2b:3c:4d:5e"
142+
depends_on = [nios_ipam_network.create_network]
143+
}
144+
````
145+
146+
You can now run `terraform plan` to see what resources will be created.
147+
148+
```shell
149+
terraform plan
150+
```
151+
152+
## Applying the Configuration
153+
154+
To create the resources, run the following command:
155+
156+
```shell
157+
terraform apply
158+
```
159+
160+
## Destroying the Configuration
161+
162+
To destroy all the resources, run the following command:
163+
164+
```shell
165+
terraform destroy
166+
```
167+
168+
## Configuring Datasources
169+
170+
Datasources allow you to retrieve existing NIOS objects. Here's a simple example:
171+
172+
````terraform
173+
// Get an existing DNS zone
174+
data "nios_dns_zone_auth" "get_auth_zone" {
175+
fqdn = "exampledomain.com"
176+
view = "default"
177+
}
178+
179+
// Output the zone information
180+
output "zone_info" {
181+
value = {
182+
zone_name = data.nios_dns_zone_auth.get_auth_zone.fqdn
183+
zone_view = data.nios_dns_zone_auth.get_auth_zone.view
184+
}
185+
}
186+
````
187+
188+
## Next steps
189+
190+
You can also use the NIOS Terraform Provider to manage other resources. For more information, see the [NIOS Terraform Provider documentation](https://registry.terraform.io/providers/infobloxopen/nios/latest/docs).

0 commit comments

Comments
 (0)