Skip to content

Commit

Permalink
Merge pull request #34 from mohith10/externalDNS-feature
Browse files Browse the repository at this point in the history
Added External DNS Feature
  • Loading branch information
hughwphamill authored Feb 1, 2024
2 parents 11025d8 + fc70cb2 commit 9fb0cf3
Show file tree
Hide file tree
Showing 14 changed files with 761 additions and 38 deletions.
49 changes: 49 additions & 0 deletions docs/data-sources/external_dns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "dcloud_external_dns Data Source - terraform-provider-dcloud"
subcategory: ""
description: |-
All the dns records currently in a given topology
---

# dcloud_external_dns (Data Source)

All the dns records currently in a given topology


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

### Required

- `topology_uid` (String)

### Read-Only

- `id` (String) The ID of this resource.
- `external_dns` (List of Object) (see [below for nested schema](#nestedatt--external_dns))

<a id="nestedatt--external_dns"></a>
### Nested Schema for `external_dns`

Read-Only:

- `uid` (String)
- `topology_uid` (String)
- `hostname` (String)
- `nat_rule_id` (String)
- `a_record` (String)
- `srv_records` (List of Object) (see [below for nested schema](#nestedobjatt--external_dns--srv_records))


<a id="nestedobjatt--external_dns--srv_records"></a>
### Nested Schema for `external_dns.srv_records`

Read-Only:

- `protocol` (String)
- `service` (String)
- `port` (Int)
- `uid` (String)


35 changes: 35 additions & 0 deletions docs/data-sources/inventory_dns_assets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "dcloud_inventory_dns_assets Data Source - terraform-provider-dcloud"
subcategory: ""
description: |-
All the inventory dns assets available to be used in a topology
---

# dcloud_inventory_dns_assets (Data Source)

All the inventory dns assets available to be used in a topology



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

### Required

- `topology_uid` (String)

### Read-Only

- `id` (String) The ID of this resource.
- `inventory_dns_assets` (List of Object) (see [below for nested schema](#nestedatt--inventory_dns_assets))

<a id="nestedatt--inventory_dns_assets"></a>
### Nested Schema for `inventory_dns_assets`

Read-Only:

- `id` (String)
- `name` (String)


32 changes: 32 additions & 0 deletions docs/data-sources/inventory_srv_protocols.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "dcloud_inventory_srv_protocols Data Source - terraform-provider-dcloud"
subcategory: ""
description: |-
All the inventory srv protocols available to be used in a topology
---

# dcloud_inventory_srv_protocols (Data Source)

All the inventory srv protocols available to be used in a topology



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


### Read-Only

- `id` (String) The ID of this resource.
- `inventory_srv_protocols` (List of Object) (see [below for nested schema](#nestedatt--inventory_srv_protocols))

<a id="nestedatt--inventory_srv_protocols"></a>
### Nested Schema for `inventory_srv_protocols`

Read-Only:

- `id` (String)
- `protocol` (String)


38 changes: 38 additions & 0 deletions docs/resources/external_dns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "dcloud_mail_server Resource - terraform-provider-dcloud"
subcategory: ""
description: |-
---

# dcloud_mail_server (Resource)


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

### Required

- `nat_rule_id` (String)
- `hostname` (String)
- `topology_uid` (String)

### Optional

- `srv_records` (Block List, Min: 1) (see [below for nested schema](#nestedblock--srv_records))

<a id="nestedblock--srv_records"></a>
### Nested Schema for `srv_records`

Required:

- `protocol` (Boolean)
- `service` (String)
- `port` (Int)

### Read-Only

- `id` (String) The ID of this resource.
- `a_record` (String)
- `uid` (String)
46 changes: 46 additions & 0 deletions examples/data-sources/external_dns_data_source/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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 External DNS rules"
description = "Will be used to load External DNS Rules"
notes = ""
datacenter = "LON"
}

resource "dcloud_ip_nat_rule" "test_topology_ip_nat_rule"{
topology_uid = dcloud_topology.test_topology.id
target_ip_address = "192.168.1.1"
target_name = "Sample Device"
east_west = false
}

resource "dcloud_external_dns" "test_topology_external_dns"{
topology_uid = dcloud_topology.test_topology.id
nat_rule_id = dcloud_ip_nat_rule.test_topology_ip_nat_rule.id
hostname = "localhost"
srv_records{
service = "_test"
protocol = "TCP"
port = 8081
}
}

data "dcloud_external_dns" "external_dns_test"{
depends_on = [dcloud_external_dns.test_topology_external_dns]
topology_uid = dcloud_topology.test_topology.id
}

output "external_dns" {
value = data.dcloud_external_dns.external_dns_test
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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 External DNS Assets"
description = "Will be used to load External DNS assets"
notes = ""
datacenter = "LON"
}

data "dcloud_inventory_dns_assets" "test_dns_assets" {
topology_uid = dcloud_topology.test_topology.id
}

output "dns_assets" {
value = data.dcloud_inventory_dns_assets.test_dns_assets
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_providers {
dcloud = {
version = "0.1"
source = "cisco-open/dcloud"
}
}
}

provider "dcloud" {
tb_url = "https://tbv3-production.ciscodcloud.com/api"
}

data "dcloud_inventory_srv_protocols" "test_srv_protocols" {
}

output "srv_protocols" {
value = data.dcloud_inventory_srv_protocols.test_srv_protocols
}
51 changes: 13 additions & 38 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,42 +159,6 @@ resource "dcloud_vm" "vm3" {
}
}

resource "dcloud_vm" "vm4" {
inventory_vm_id = "7668085"
topology_uid = dcloud_topology.test_topology.id
name = "Ubuntu Desktop 4"
description = "A standard Ubuntu Desktop VM"
cpu_qty = 1
memory_mb = 1024

network_interfaces{
network_uid = dcloud_network.unrouted_network.id
name = "Network adapter 1"
mac_address = "00:50:56:00:04:AA"
type = "VIRTUAL_E1000"
ip_address = "127.0.0.5"
ssh_enabled = true
rdp_enabled = true
rdp_auto_login = true
}

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
}

remote_access {
vm_console_enabled = true
display_credentials {
username = "displayuser"
password = "displaypassword"
}
}
}


resource "dcloud_hw" "hw1" {
topology_uid = dcloud_topology.test_topology.id
inventory_hw_id = "76"
Expand Down Expand Up @@ -327,8 +291,19 @@ resource "dcloud_inbound_proxy_rule" "inbound_proxy_rule"{
show_hyperlink = true
}

resource "dcloud_external_dns" "external_dns"{
topology_uid = dcloud_topology.test_topology.id
nat_rule_id = dcloud_ip_nat_rule.ip_nat_rule.id
hostname = "localhost"
srv_records{
service = "_test"
protocol = "TCP"
port = 8081
}
}

resource "dcloud_mail_server" "mail_server"{
topology_uid = dcloud_topology.test_topology.id
nic_uid = dcloud_vm.vm4.network_interfaces[0].uid
nic_uid = dcloud_vm.vm3.network_interfaces[0].uid
dns_asset_id = "3"
}
}
Loading

0 comments on commit 9fb0cf3

Please sign in to comment.