-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from mohith10/vmNat-feature
Added NAT feature to support both Ip and Vm nat
- Loading branch information
Showing
17 changed files
with
791 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "dcloud_ip_nat_rules Data Source - terraform-provider-dcloud" | ||
subcategory: "" | ||
description: |- | ||
All the IP Nat rules currently in a given topology | ||
--- | ||
|
||
# dcloud_ip_nat_rules (Data Source) | ||
|
||
All the IP Nat rules currently in a given topology | ||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `topology_uid` (String) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `ip_nat_rules` (List of Object) (see [below for nested schema](#nestedatt--ip_nat_rules)) | ||
|
||
<a id="nestedatt--ip_nat_rules"></a> | ||
### Nested Schema for `ip_nat_rules` | ||
|
||
Read-Only: | ||
|
||
- `target_ip_address` (String) | ||
- `target_name` (String) | ||
- `east_west` (Bool) | ||
- `topology_uid` (String) | ||
- `uid` (String) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "dcloud_vm_nat_rules Data Source - terraform-provider-dcloud" | ||
subcategory: "" | ||
description: |- | ||
All the VM Nat rules currently in a given topology | ||
--- | ||
|
||
# dcloud_vm_nat_rules (Data Source) | ||
|
||
All the VM Nat rules currently in a given topology | ||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `topology_uid` (String) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `vm_nat_rules` (List of Object) (see [below for nested schema](#nestedatt--vm_nat_rules)) | ||
|
||
<a id="nestedatt--vm_nat_rules"></a> | ||
### Nested Schema for `vm_nat_rules` | ||
|
||
Read-Only: | ||
|
||
- `target_ip_address` (String) | ||
- `target_name` (String) | ||
- `nic_uid` (String) | ||
- `east_west` (Bool) | ||
- `topology_uid` (String) | ||
- `uid` (String) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "dcloud_ip_nat_rule Resource - terraform-provider-dcloud" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# dcloud_ip_nat_rule (Resource) | ||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `target_ip_address` (String) | ||
- `target_name` (String) | ||
- `east_west` (Bool) | ||
- `topology_uid` (String) | ||
|
||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `uid` (String) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "dcloud_vm_nat_rule Resource - terraform-provider-dcloud" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# dcloud_vm_nat_rule (Resource) | ||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `target_ip_address` (String) | ||
- `target_name` (String) | ||
- `nic_uid` (String) | ||
- `east_west` (Bool) | ||
- `topology_uid` (String) | ||
|
||
|
||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `uid` (String) | ||
|
||
|
||
|
34 changes: 34 additions & 0 deletions
34
examples/data-sources/ip_nat_rule_data_source/data-source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
terraform { | ||
required_providers { | ||
dcloud = { | ||
version = "0.1" | ||
source = "cisco-open/dcloud" | ||
} | ||
} | ||
} | ||
|
||
provider "dcloud" { | ||
tb_url = "https://tbv3-production.ciscodcloud.com/api" | ||
} | ||
|
||
resource "dcloud_topology" "test_topology" { | ||
name = "Test Topology For Testing IP NAT Rule" | ||
description = "Will be used to create IP NAT rules " | ||
notes = "" | ||
datacenter = "LON" | ||
} | ||
|
||
resource "dcloud_ip_nat_rule" "ip_nat"{ | ||
topology_uid = dcloud_topology.test_topology.id | ||
target_ip_address = "192.168.1.1" | ||
target_name = "Sample Device" | ||
east_west = true | ||
} | ||
|
||
data "dcloud_ip_nat_rules" "test_topology_ip_nat_rules"{ | ||
topology_uid = dcloud_topology.test_topology.id | ||
} | ||
|
||
output "ip_nat_rules" { | ||
value = data.dcloud_ip_nat_rules.test_topology_ip_nat_rules | ||
} |
99 changes: 99 additions & 0 deletions
99
examples/data-sources/vm_nat_rule_data_source/data-source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
terraform { | ||
required_providers { | ||
dcloud = { | ||
version = "0.1" | ||
source = "cisco-open/dcloud" | ||
} | ||
} | ||
} | ||
|
||
provider "dcloud" { | ||
tb_url = "https://tbv3-production.ciscodcloud.com/api" | ||
} | ||
|
||
resource "dcloud_topology" "test_topology" { | ||
name = "Test Topology For Testing VM NAT Rule" | ||
description = "Will be used to create VM NAT rules " | ||
notes = "" | ||
datacenter = "LON" | ||
} | ||
|
||
resource "dcloud_network" "routed_network" { | ||
name = "A routed network" | ||
description = "Demonstrating a network routed through VPOD Gateway" | ||
inventory_network_id = "L3-VLAN-2" | ||
topology_uid = dcloud_topology.test_topology.id | ||
} | ||
|
||
resource "dcloud_network" "unrouted_network" { | ||
name = "An unrouted network" | ||
description = "Demonstrating a network not routed through VPOD Gateway" | ||
inventory_network_id = "L2-VLAN-16" | ||
topology_uid = dcloud_topology.test_topology.id | ||
} | ||
|
||
resource "dcloud_vm" "vm1" { | ||
inventory_vm_id = "7668085" | ||
topology_uid = dcloud_topology.test_topology.id | ||
name = "Ubuntu Desktop 1" | ||
description = "A standard Ubuntu Desktop VM" | ||
cpu_qty = 8 | ||
memory_mb = 8192 | ||
nested_hypervisor = false | ||
os_family = "LINUX" | ||
|
||
advanced_settings { | ||
all_disks_non_persistent = false | ||
bios_uuid = "42 3a 5f 9d f1 a8 7c 0e-7d c2 44 27 2e d6 67 aa" | ||
name_in_hypervisor = "ubuntu" | ||
not_started = false | ||
} | ||
|
||
network_interfaces { | ||
network_uid = dcloud_network.routed_network.id | ||
name = "Network adapter 0" | ||
mac_address = "00:50:56:00:01:AA" | ||
type = "VIRTUAL_E1000" | ||
} | ||
|
||
network_interfaces{ | ||
network_uid = dcloud_network.unrouted_network.id | ||
name = "Network adapter 1" | ||
mac_address = "00:50:56:00:01:AB" | ||
type = "VIRTUAL_E1000" | ||
ip_address = "127.0.0.2" | ||
ssh_enabled = true | ||
rdp_enabled = true | ||
rdp_auto_login = true | ||
} | ||
|
||
remote_access { | ||
username = "user" | ||
password = "password" | ||
vm_console_enabled = true | ||
|
||
display_credentials { | ||
username = "displayuser" | ||
password = "displaypassword" | ||
} | ||
} | ||
|
||
guest_automation { | ||
command = "RUN PROGRAM" | ||
delay_seconds = 10 | ||
} | ||
} | ||
|
||
resource "dcloud_vm_nat_rule" "vm_nat"{ | ||
topology_uid = dcloud_topology.test_topology.id | ||
nic_uid = dcloud_vm.vm1.network_interfaces[1].uid | ||
east_west = true | ||
} | ||
|
||
data "dcloud_vm_nat_rules" "test_topology_vm_nat_rules"{ | ||
topology_uid = dcloud_topology.test_topology.id | ||
} | ||
|
||
output "vm_nat_rules" { | ||
value = data.dcloud_vm_nat_rules.test_topology_vm_nat_rules | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
terraform { | ||
required_providers { | ||
dcloud = { | ||
version = "0.1" | ||
source = "cisco-open/dcloud" | ||
} | ||
} | ||
} | ||
|
||
provider "dcloud" { | ||
tb_url = "https://tbv3-production.ciscodcloud.com/api" | ||
} | ||
|
||
resource "dcloud_topology" "test_topology" { | ||
name = "IP NAT Rule Resource Test" | ||
description = "Testing IP NAT Rule Resource Management" | ||
notes = "Created via Terraform Test" | ||
datacenter = "LON" | ||
} | ||
|
||
resource "dcloud_ip_nat_rule" "test_ip_nat"{ | ||
topology_uid = dcloud_topology.test_topology.id | ||
target_ip_address = "192.168.1.1" | ||
target_name = "Sample Device" | ||
east_west = true | ||
} |
Oops, something went wrong.