Skip to content

Commit

Permalink
[minor_change] Add name attribute for the subnet in resource_mso_sche…
Browse files Browse the repository at this point in the history
…ma_site_vrf_region (#140)
  • Loading branch information
shrsr authored Aug 26, 2022
1 parent e2a8f2b commit 8e8e8d4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 17 deletions.
19 changes: 10 additions & 9 deletions examples/schema_site_vrf_region/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ provider "mso" {
}

resource "mso_schema_site_vrf_region" "vrfRegion" {
schema_id = "5efd6ea60f00005b0ebbd643"
template_name = "Template1"
site_id = "5efeb3c4190000cc12d05376"
vrf_name = "Myvrf"
region_name = "us-east-1"
vpn_gateway = true
schema_id = "5efd6ea60f00005b0ebbd643"
template_name = "Template1"
site_id = "5efeb3c4190000cc12d05376"
vrf_name = "Myvrf"
region_name = "us-east-1"
vpn_gateway = true
hub_network_enable = true
hub_network = {
name = "hub-fualt"
name = "hub-fualt"
tenant_name = "infra"
}
cidr {
cidr_ip = "2.2.2.2/10"
primary = true
subnet {
ip = "1.20.30.4"
zone = "us-east-1b"
ip = "1.20.30.4"
name = "subnet1"
zone = "us-east-1b"
usage = "gateway"
}
}
Expand Down
9 changes: 9 additions & 0 deletions mso/datasource_mso_schema_site_vrf_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func dataSourceMSOSchemaSiteVrfRegion() *schema.Resource {
Computed: true,
ValidateFunc: validation.StringLenBetween(1, 1000),
},
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringLenBetween(1, 1000),
},
"zone": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -223,6 +229,9 @@ func dataSourceMSOSchemaSiteVrfRegionRead(d *schema.ResourceData, m interface{})

subnetMap := make(map[string]interface{})
subnetMap["ip"] = subnet["ip"]
if subnet["name"] != nil {
subnetMap["name"] = subnet["name"]
}
if subnet["zone"] != nil {
subnetMap["zone"] = subnet["zone"]
}
Expand Down
19 changes: 19 additions & 0 deletions mso/resource_mso_schema_site_vrf_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@ func resourceMSOSchemaSiteVrfRegion() *schema.Resource {
Required: true,
ValidateFunc: validation.StringLenBetween(1, 1000),
},
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringLenBetween(1, 1000),
},
"zone": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringLenBetween(1, 1000),
},
"usage": &schema.Schema{
Expand Down Expand Up @@ -223,6 +230,9 @@ func resourceMSOSchemaSiteVrfRegionImport(d *schema.ResourceData, m interface{})

subnetMap := make(map[string]interface{})
subnetMap["ip"] = subnet["ip"]
if subnet["name"] != nil {
subnetMap["name"] = subnet["name"]
}
if subnet["zone"] != nil {
subnetMap["zone"] = subnet["zone"]
}
Expand Down Expand Up @@ -309,6 +319,9 @@ func resourceMSOSchemaSiteVrfRegionCreate(d *schema.ResourceData, m interface{})

subnetMap := make(map[string]interface{})
subnetMap["ip"] = subnet["ip"]
if subnet["name"] != nil {
subnetMap["name"] = subnet["name"]
}
if subnet["zone"] != nil {
subnetMap["zone"] = subnet["zone"]
}
Expand Down Expand Up @@ -389,6 +402,9 @@ func resourceMSOSchemaSiteVrfRegionUpdate(d *schema.ResourceData, m interface{})

subnetMap := make(map[string]interface{})
subnetMap["ip"] = subnet["ip"]
if subnet["name"] != nil {
subnetMap["name"] = subnet["name"]
}
if subnet["zone"] != nil {
subnetMap["zone"] = subnet["zone"]
}
Expand Down Expand Up @@ -508,6 +524,9 @@ func resourceMSOSchemaSiteVrfRegionRead(d *schema.ResourceData, m interface{}) e

subnetMap := make(map[string]interface{})
subnetMap["ip"] = subnet["ip"]
if subnet["name"] != nil {
subnetMap["name"] = subnet["name"]
}
if subnet["zone"] != nil {
subnetMap["zone"] = subnet["zone"]
}
Expand Down
9 changes: 5 additions & 4 deletions website/docs/d/schema_site_vrf_region.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ data "mso_schema_site_vrf_region" "vrfRegion" {
* `template_name` - (Optional) Template where Vrf Region to be created.

* `cidr` - (Optional) CIDR to set into region
* `cidr.cidr_ip` - (Optional) Ip address for cidr.
* `cidr.primary` - (Optional) primary flag to set above ip as primary for cidr. Only one ip must be set as primary.
* `cidr.cidr_ip` - (Optional) IP address for CIDR.
* `cidr.primary` - (Optional) primary flag to set CIDR as primary. Only one CIDR can be set as primary.

* `cidr.subnet` - (Optional) subnets to associate with cidr.
* `cidr.subnet.ip` - (Optional) ip address for subnet.
* `cidr.subnet` - (Optional) subnets to associate with CIDR.
* `cidr.subnet.ip` - (Optional) IP address for the subnet.
* `cidr.subnet.name` - (Optional) Name for the subnet.
* `cidr.subnet.zone` - (Optional) zone for the subnet.
* `cidr.subnet.usage` - (Optional) usage information of particular subnet.

Expand Down
10 changes: 6 additions & 4 deletions website/docs/r/schema_site_vrf_region.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ resource "mso_schema_site_vrf_region" "vrfRegion" {
primary = true
subnet {
ip = "1.20.30.4"
name = "subnet1"
zone = "us-east-1b"
usage = "sdfkhsdkf"
}
Expand All @@ -48,11 +49,12 @@ resource "mso_schema_site_vrf_region" "vrfRegion" {
* `template_name` - (Required) Template where Vrf Region to be created.

* `cidr` - (Required) CIDR to set into region
* `cidr.cidr_ip` - (Required) Ip address for cidr.
* `cidr.primary` - (Required) Primary flag to set above ip as primary for cidr. Only one ip must be set as primary.
* `cidr.cidr_ip` - (Required) IP address for CIDR.
* `cidr.primary` - (Required) Primary flag to set CIDR as primary. Only one CIDR can be set as primary.

* `cidr.subnet` - (Required) Subnets to associate with cidr.
* `cidr.subnet.ip` - (Required) Ip address for subnet.
* `cidr.subnet` - (Required) Subnets to associate with CIDR.
* `cidr.subnet.ip` - (Required) IP address for the subnet.
* `cidr.subnet.name` - (Required) Name for the subnet.
* `cidr.subnet.zone` - (Optional) The name of the availability zone for the subnet. This argument is required for AWS sites.
* `cidr.subnet.usage` - (Optional) Usage information of particular subnet.

Expand Down

0 comments on commit 8e8e8d4

Please sign in to comment.