Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ examples/terraform_config/*.log
*.tfstate
testing/logs
dist/
generator/templates/*
/templates*
generator/tools/*


12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.2.0

_Pre Release_
### Added
- New Resources
- `ndfc_links`
- `ndfc_rest_api`
- New Data Sources
- `ndfc_rest_api`
- Policy group support in `ndfc_policy` resource
- Bug Fixes

## 0.1.0

_Pre Release_
Expand Down
40 changes: 40 additions & 0 deletions docs/data-sources/rest_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "ndfc_rest_api Data Source - terraform-provider-ndfc"
subcategory: ""
description: |-
Datasource to retrieve data from any REST API on NDFC.Note: url fields are pre-fixed with the NDFC base URL which also includes <base_url>/appcenter/cisco/ndfc/api/v1/. Hence always use urls relative to above base URL.
url - specify the API and method to specify the HTTP method to be used for CRUD operations.query_parameters - specify the query parameters for the GET operation if anyresponse_message - The response message from the API for the GET operation
---

# ndfc_rest_api (Data Source)

Datasource to retrieve data from any REST API on NDFC.
Note: `url` fields are pre-fixed with the NDFC base URL which also includes `<base_url>/appcenter/cisco/ndfc/api/v1/`.
Hence always use urls relative to above base URL.
- `url` - specify the API and `method` to specify the HTTP method to be used for CRUD operations.
- `query_parameters` - specify the query parameters for the GET operation if any
- `response_message` - The response message from the API for the GET operation

## Example Usage

```terraform
data "ndfc_rest_api" "test_resource_rest_api_1" {
url = "/lan-fabric/rest/control/policies"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `url` (String) URL to be used for GET - Note: This is prefixed with base_url

### Optional

- `query_parameters` (String) Query parameters for GET API if any; format is key1=value1&key2=value2

### Read-Only

- `response_message` (String) Response message from the API for the GET operation
83 changes: 83 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,86 @@ username, password, url, timeout, domain and insecure can also be supplied as en
- `timeout` (Number) NDFC HTTP request timeout - timeout. Enviroment variable `NDFC_TIMEOUT` can be used to override the provider configuration.



## General Guidelines

### Order of operations (Dependencies)

The NDFC provider resources must be created in a specific order to satisfy infrastructure dependencies. Use Terraform's `depends_on` meta-argument to enforce the correct ordering when implicit dependencies are not sufficient.

#### Dependency Hierarchy

The following hierarchy shows the order in which resources should be created:

1. **`ndfc_fabric_vxlan_evpn`** - Create the fabric first
- This is the foundation for all other resources

2. **`ndfc_inventory_devices`** - Add devices to the fabric
- Depends on: `ndfc_fabric_vxlan_evpn`

3. **`ndfc_vpc_pair`** - Configure VPC pairs on devices
- Depends on: `ndfc_inventory_devices`

4. **Interface and VRF resources** (parallel - all depend on VPC pair):
- **`ndfc_interface_ethernet`** - Depends on: `ndfc_vpc_pair`
- **`ndfc_interface_loopback`** - Depends on: `ndfc_vpc_pair`
- **`ndfc_interface_vlan`** - Depends on: `ndfc_vpc_pair`
- **`ndfc_vrfs`** - Depends on: `ndfc_vpc_pair`

5. **`ndfc_interface_portchannel`** - Configure port-channel interfaces
- Depends on: `ndfc_interface_ethernet`
- Note that the ports that are to be part of port-channel must be created first, as a reverse order is not supported.

6. **`ndfc_interface_vpc`** - Configure VPC interfaces
- Depends on: `ndfc_inventory_devices` and `ndfc_vpc_pair`
- Note that the ports that are to be part of VPC must be created first, as a reverse order is not supported.

7. **`ndfc_networks`** - Create networks/VLANs
- Depends on: `ndfc_vrfs`

8. **`ndfc_policy`** - Apply policies
- Depends on: `ndfc_networks`

9. **`ndfc_configuration_deploy`** - Deploy configurations globally
- Should be the last resource when using global deployment
- Depends on all interface and network resources that need deployment

#### Example with Explicit Dependencies

```hcl
resource "ndfc_fabric_vxlan_evpn" "example" {
fabric_name = "my-fabric"
# ... other attributes
}

resource "ndfc_inventory_devices" "example" {
fabric_name = ndfc_fabric_vxlan_evpn.example.fabric_name
# Implicit dependency through fabric_name reference
# ... other attributes
}

resource "ndfc_vpc_pair" "example" {
# ... other attributes
depends_on = [ndfc_inventory_devices.example]
}

resource "ndfc_vrfs" "example" {
fabric_name = ndfc_fabric_vxlan_evpn.example.fabric_name
# ... other attributes
depends_on = [ndfc_vpc_pair.example]
}

resource "ndfc_networks" "example" {
fabric_name = ndfc_fabric_vxlan_evpn.example.fabric_name
# ... other attributes
depends_on = [ndfc_vrfs.example]
}

resource "ndfc_policy" "example" {
# ... other attributes
depends_on = [ndfc_networks.example]
}
```

**Note**: Some dependencies may be implicit through resource references (e.g., using `ndfc_fabric_vxlan_evpn.example.fabric_name`). However, explicit `depends_on` declarations are recommended when the dependency is not captured through attribute references.

10 changes: 10 additions & 0 deletions docs/resources/fabric_ipfm.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,13 @@ resource "ndfc_fabric_ipfm" "test_resource_fabric_ipfm_1" {
- `rp_ip_range_internal` (String) Internal RP IP Range
- `spine_count` (Number) Spine Count
- `upgrade_from_version` (String) Upgrade From Version

## Import

Import is supported using the following syntax:

```shell
# Format of ID used for import:
# Name of the fabric you would want to import for this resource
terraform import ndfc_fabric_ipfm.test_resource_fabric_ipfm IP_FABRIC_MEDIA
```
10 changes: 10 additions & 0 deletions docs/resources/fabric_lan_classic.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,13 @@ resource "ndfc_fabric_lan_classic" "test_resource_fabric_lan_classic_1" {
- `mgmt_v6prefix` (Number) Switch Mgmt IPv6 Subnet Prefix (Min:64, Max:126)
- `mgmt_v6prefix_internal` (Number) Internal Management IPv6 Prefix
- `pm_enable_prev` (Boolean) Previous state of Enable Performance Monitoring

## Import

Import is supported using the following syntax:

```shell
# Format of ID used for import:
# Name of the fabric you would want to import for this resource
terraform import ndfc_fabric_lan_classic.test_resource_fabric_lan_classic TF_FABRIC_LAN_CLASSIC
```
10 changes: 10 additions & 0 deletions docs/resources/fabric_msite_ext_net.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,13 @@ resource "ndfc_fabric_msite_ext_net" "test_resource_fabric_msite_ext_net_1" {
- `pm_enable_prev` (Boolean) Previous state of Enable Performance Monitoring
- `pnp_enable_internal` (Boolean) Internal PnP Enable
- `premso_parent_fabric` (String) Pre-MSO Parent Fabric

## Import

Import is supported using the following syntax:

```shell
# Format of ID used for import:
# Name of the fabric you would want to import for this resource
terraform import ndfc_fabric_msite_ext_net.test_resource_fabric_msite_ext_net TF_FABRIC_MSITE_EXT_NET
```
10 changes: 10 additions & 0 deletions docs/resources/fabric_vxlan_evpn.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,13 @@ resource "ndfc_fabric_vxlan_evpn" "test_resource_fabric_vxlan_evpn_1" {
- `unnum_dhcp_end_internal` (String) Internal Unnumbered DHCP End Address
- `unnum_dhcp_start_internal` (String) Internal Unnumbered DHCP Start Address
- `upgrade_from_version` (String) Upgrade from Version

## Import

Import is supported using the following syntax:

```shell
# Format of ID used for import:
# Name of the fabric you would want to import for this resource
terraform import ndfc_fabric_vxlan_evpn.test_resource_fabric_vxlan_evpn TF_FABRIC_VXLAN_EVPN
```
12 changes: 12 additions & 0 deletions docs/resources/fabric_vxlan_msd.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ resource "ndfc_fabric_vxlan_msd" "test_resource_fabric_vxlan_msd_1" {
anycast_gw_mac = "2020.0000.00aa"
bgw_routing_tag = 54321
border_gwy_connections = "Manual"
child_fabrics = ["TF_FABRIC_VXLAN_1", "TF_FABRIC_VXLAN_2"]
cloudsec_autoconfig = false
dci_subnet_range = "10.10.1.0/24"
dci_subnet_target_mask = 30
Expand Down Expand Up @@ -52,6 +53,7 @@ resource "ndfc_fabric_vxlan_msd" "test_resource_fabric_vxlan_msd_1" {
- `bgp_rp_asn` (String) 1-4294967295 | 1-65535[.0-65535], e.g. 65000, 65001
- `bgw_routing_tag` (Number) Routing tag associated with IP address of loopback and DCI interfaces
- `border_gwy_connections` (String) Manual, Auto Overlay EVPN Peering to Route Servers, Auto Overlay EVPN Direct Peering to Border Gateways
- `child_fabrics` (Set of String) Add child fabrics to the MSD fabric
- `cloudsec_algorithm` (String) CloudSec Cryptographic Algorithm
- `cloudsec_autoconfig` (Boolean) Auto Config CloudSec on Border Gateways
- `cloudsec_enforcement` (String) If set to 'strict', data across site must be encrypted.
Expand Down Expand Up @@ -118,3 +120,13 @@ resource "ndfc_fabric_vxlan_msd" "test_resource_fabric_vxlan_msd_1" {
- `sgt_preprov_recalc_status` (String) Recalculation status for Security Groups Pre-provision
- `sgt_preprovision_prev` (Boolean) Previous state of Security Groups Pre-provision
- `sgt_recalc_status` (String) Recalculation status for Security Groups

## Import

Import is supported using the following syntax:

```shell
# Format of ID used for import:
# Name of the fabric you would want to import for this resource
terraform import ndfc_fabric_vxlan_msd.test_resource_fabric_vxlan_msd TF_FABRIC_VXLAN_MSD
```
Loading