From ac8320267a179d52e113390760d7f26653df7845 Mon Sep 17 00:00:00 2001 From: 205101-retr0 Date: Thu, 26 Oct 2023 10:15:32 +0530 Subject: [PATCH 1/3] added fix for terraform refresh --- fmc/resource_fmc_staticIPv4_route.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/fmc/resource_fmc_staticIPv4_route.go b/fmc/resource_fmc_staticIPv4_route.go index 710963c..04ad86f 100644 --- a/fmc/resource_fmc_staticIPv4_route.go +++ b/fmc/resource_fmc_staticIPv4_route.go @@ -2,6 +2,7 @@ package fmc import ( "context" + "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -241,15 +242,21 @@ func resourceFmcStaticIPv4RouteRead(ctx context.Context, d *schema.ResourceData, // Warning or errors can be collected in a slice type var diags diag.Diagnostics + // Why this GetStatic IPv4 route but others FmcStaticIPv4 item, err := c.GetFmcStaticIPv4Route(ctx, d.Get("device_id").(string), d.Id()) if err != nil { - diags = append(diags, diag.Diagnostic{ - Severity: diag.Error, - Summary: "unable to read route", - Detail: err.Error(), - }) + if strings.Contains(err.Error(), "404") { + d.SetId("") + } else { + diags = append(diags, diag.Diagnostic{ + Severity: diag.Error, + Summary: "unable to read route", + Detail: err.Error(), + }) + } return diags } + if err := d.Set("interface_name", item.InterfaceName); err != nil { diags = append(diags, diag.Diagnostic{ Severity: diag.Error, From 1fe8f87f255a1f36cd08eb656f2b623bb4daa0da Mon Sep 17 00:00:00 2001 From: Suraj Date: Mon, 6 Nov 2023 14:57:21 +0530 Subject: [PATCH 2/3] Resolves #131 --- docs/resources/security_zone.md | 1 + fmc/resource_fmc_security_zone.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/docs/resources/security_zone.md b/docs/resources/security_zone.md index 59ee38c..65f0130 100644 --- a/docs/resources/security_zone.md +++ b/docs/resources/security_zone.md @@ -39,5 +39,6 @@ resource "fmc_security_zone" "test" { ### Read-Only - `id` (String) The ID of this resource. +- `type` (String) The type of this resource diff --git a/fmc/resource_fmc_security_zone.go b/fmc/resource_fmc_security_zone.go index dec4262..96f3571 100644 --- a/fmc/resource_fmc_security_zone.go +++ b/fmc/resource_fmc_security_zone.go @@ -28,6 +28,11 @@ func resourceFmcSecurityZone() *schema.Resource { UpdateContext: resourceFmcSecurityZoneUpdate, DeleteContext: resourceFmcSecurityZoneDelete, Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type of this resource", + }, "name": { Type: schema.TypeString, Required: true, @@ -100,6 +105,16 @@ func resourceFmcSecurityZoneRead(ctx context.Context, d *schema.ResourceData, m return diags } } + + if err := d.Set("type", item.Type); err != nil { + diags = append(diags, diag.Diagnostic{ + Severity: diag.Error, + Summary: "unable to read security zone", + Detail: err.Error(), + }) + return diags + } + if err := d.Set("name", item.Name); err != nil { diags = append(diags, diag.Diagnostic{ Severity: diag.Error, From 4f12168ac3362109fa7dce08233269851443b235 Mon Sep 17 00:00:00 2001 From: Suraj Date: Mon, 6 Nov 2023 17:08:56 +0530 Subject: [PATCH 3/3] Fixes #139 --- .DS_Store | Bin 6148 -> 6148 bytes examples/fmc_device_sub_interfaces/main.tf | 50 +++++++++--------- fmc/fmc_device_physicalinterfaces.go | 6 +-- fmc/resource_fmc_device_physicalinterfaces.go | 3 +- fmc/resource_fmc_device_subinterfaces.go | 32 +++++------ fmc/resource_fmc_device_vni.go | 5 +- 6 files changed, 50 insertions(+), 46 deletions(-) diff --git a/.DS_Store b/.DS_Store index edad4a235d77862a6c54328033a5ac836c5c82a6..6f28bd7eb3856f2f7f0ba6382b82d6db1d7b24e7 100644 GIT binary patch delta 353 zcmZoMXfc=|#>B)qF;R?_gMop8V`8F+EEA9c0?a_n$iN`Lz)--D!;s2QoK#+1urYBt zV?9WQ11M6#kjRjWESr>*p9GZKkyMbASzKaZaE+0PnT3^&or9f&nXr1w@?l^GXsk^HPhz8ZuK-fl6Y+GxJjN%boH|^HS=I z!J301G8~*7obdt@)z!vEraB6ymIk#t3e}cI2098R#%8s(oE)Oc`qn}5**Up+`CUNA z0Rbb>TVTKorD0Szkb&W`vf!e;ocz3Wpd3gaGs8qfv5lE8SSA~Yux#cAdJGtV8xy}X WPv#dCFKmTbKdS$y8?m delta 80 zcmZoMXfc=|#>AjHu~2w2Gqa2!69WV=0x2LCVAw3c{GDa90rL)~&Fmcf96+U;6`8*? YPv#d<