Skip to content

Commit

Permalink
[bugfix] Fix aci_bulk_epg_to_static_path idempotency and default valu…
Browse files Browse the repository at this point in the history
…es when optional attributes not provided.
  • Loading branch information
lhercot committed Aug 3, 2022
1 parent 6da8f21 commit 32d9622
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
15 changes: 10 additions & 5 deletions aci/resource_aci_fvrsbulkpathatt.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,31 @@ func resourceAciBulkStaticPath() *schema.Resource {
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
},
"deployment_immediacy": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"immediate",
"lazy",
}, false),
Default: "lazy",
},
"mode": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"regular",
"native",
"untagged",
}, false),
Default: "regular",
},
"primary_encap": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
Default: "unknown",
},
},
},
Expand Down Expand Up @@ -232,10 +233,14 @@ func staticPathPayload(staticPathList []interface{}, status string) []interface{
staticPathContent["descr"] = descr
}
if immediacy, ok := staticPath["deployment_immediacy"]; ok {
staticPathContent["instrImedcy"] = immediacy
if immediacy != "" {
staticPathContent["instrImedcy"] = immediacy
}
}
if mode, ok := staticPath["mode"]; ok {
staticPathContent["mode"] = mode
if mode != "" {
staticPathContent["mode"] = mode
}
}
if primaryEncap, ok := staticPath["primary_encap"]; ok {
staticPathContent["primaryEncap"] = primaryEncap
Expand Down
6 changes: 0 additions & 6 deletions examples/aci_bulk_epg_to_static_path/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ resource "aci_bulk_epg_to_static_path" "example" {
static_path {
interface_dn = "topology/pod-1/paths-129/pathep-[eth1/5]"
encap = "vlan-1000"
description = "this is desc for bulk static path"
deployment_immediacy = "lazy"
mode = "untagged"
primary_encap = "vlan-700"
}
static_path {
interface_dn = "topology/pod-1/paths-129/pathep-[eth1/6]"
encap = "vlan-1001"
description = "this is updated desc for another bulk static path"
deployment_immediacy = "immediate"
mode = "regular"
primary_encap = "vlan-800"
}
static_path {
interface_dn = "topology/pod-1/paths-129/pathep-[eth1/7]"
Expand All @@ -60,6 +55,5 @@ resource "aci_bulk_epg_to_static_path" "example" {
description = "this is desc for fourth bulk static path"
deployment_immediacy = "lazy"
mode = "native"
primary_encap = "vlan-100"
}
}
2 changes: 1 addition & 1 deletion website/docs/r/bulk_epg_to_static_path.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ resource "aci_bulk_epg_to_static_path" "example" {
* `encap` - (Required) Encapsulation to use for the Static Path (for example: vlan-100). Type: String.
* `deployment_immediacy` - (Optional) Deployment immediacy of the Static Path. Allowed values: "immediate", "lazy". Default value: "lazy". Type: String.
* `mode` - (Optional) Mode of the static association of the interface. Allowed values: "regular", "native", "untagged". Default value: "regular". Type: String.
* `primary_encap` - (Optional) Primary encapsulation for the Static Path object (used for micro-segmentation). Type: String.
* `primary_encap` - (Optional) Primary encapsulation for the Static Path object (used for micro-segmentation). Allowed values: "vlan-xxx" or "unknown". Default value: "unknown". Type: String.

## Attribute Reference

Expand Down

0 comments on commit 32d9622

Please sign in to comment.