Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr committed Mar 1, 2023
1 parent 3fe7b1e commit 62dc031
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 85 deletions.
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ build: fmtcheck
build13: GOOS=$(shell go env GOOS)
build13: GOARCH=$(shell go env GOARCH)
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/2.4.3/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/2.4.4/$(GOOS)_$(GOARCH)
else
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/2.4.3/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/2.4.4/$(GOOS)_$(GOARCH)
endif
build13: fmtcheck
go mod tidy && go mod vendor
@echo "==> Installing plugin to $(DESTINATION)"
@mkdir -p $(DESTINATION)
go build -o $(DESTINATION)/terraform-provider-zia_v2.4.3
go build -o $(DESTINATION)/terraform-provider-zia_v2.4.4

test: fmtcheck
go test $(TEST) || exit 1
Expand Down
32 changes: 16 additions & 16 deletions zia/resource_zia_traffic_forwarding_gre_tunnels.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ func resourceTrafficForwardingGRETunnel() *schema.Resource {
Description: "The primary destination data center and virtual IP address (VIP) of the GRE tunnel",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Unique identifer of the GRE virtual IP address (VIP)",
},
// "id": {
// Type: schema.TypeInt,
// Optional: true,
// Computed: true,
// Description: "Unique identifer of the GRE virtual IP address (VIP)",
// },
"virtual_ip": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -93,12 +93,12 @@ func resourceTrafficForwardingGRETunnel() *schema.Resource {
Description: "The secondary destination data center and virtual IP address (VIP) of the GRE tunnel",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Unique identifer of the GRE virtual IP address (VIP)",
},
// "id": {
// Type: schema.TypeInt,
// Optional: true,
// Computed: true,
// Description: "Unique identifer of the GRE virtual IP address (VIP)",
// },
"virtual_ip": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -243,7 +243,7 @@ func resourceTrafficForwardingGRETunnelRead(d *schema.ResourceData, m interface{
func flattenGrePrimaryDestVipSimple(primaryDestVip *gretunnels.PrimaryDestVip) interface{} {
return []map[string]interface{}{
{
"id": primaryDestVip.ID,
// "id": primaryDestVip.ID,
"virtual_ip": primaryDestVip.VirtualIP,
"private_service_edge": primaryDestVip.PrivateServiceEdge,
"datacenter": primaryDestVip.Datacenter,
Expand All @@ -253,7 +253,7 @@ func flattenGrePrimaryDestVipSimple(primaryDestVip *gretunnels.PrimaryDestVip) i
func flattenGreSecondaryDestVipSimple(secondaryDestVip *gretunnels.SecondaryDestVip) interface{} {
return []map[string]interface{}{
{
"id": secondaryDestVip.ID,
// "id": secondaryDestVip.ID,
"virtual_ip": secondaryDestVip.VirtualIP,
"private_service_edge": secondaryDestVip.PrivateServiceEdge,
"datacenter": secondaryDestVip.Datacenter,
Expand Down Expand Up @@ -341,7 +341,7 @@ func expandPrimaryDestVip(d *schema.ResourceData) *gretunnels.PrimaryDestVip {
return nil
}
return &gretunnels.PrimaryDestVip{
ID: vip["id"].(int),
// ID: vip["id"].(int),
VirtualIP: vip["virtual_ip"].(string),
PrivateServiceEdge: vip["private_service_edge"].(bool),
Datacenter: vip["datacenter"].(string),
Expand All @@ -366,7 +366,7 @@ func expandSecondaryDestVip(d *schema.ResourceData) *gretunnels.SecondaryDestVip
return nil
}
return &gretunnels.SecondaryDestVip{
ID: vip["id"].(int),
// ID: vip["id"].(int),
VirtualIP: vip["virtual_ip"].(string),
PrivateServiceEdge: vip["private_service_edge"].(bool),
Datacenter: vip["datacenter"].(string),
Expand Down
134 changes: 68 additions & 66 deletions zia/resource_zia_traffic_forwarding_static_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,58 +77,58 @@ func resourceTrafficForwardingStaticIP() *schema.Resource {
Computed: true,
Description: "Indicates whether a non-RFC 1918 IP address is publicly routable. This attribute is ignored if there is no ZIA Private Service Edge associated to the organization.",
},
"managed_by": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
Description: "This is an immutable reference to an entity. which mainly consists of id and name",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeInt,
Optional: true,
Description: "Identifier that uniquely identifies an entity",
},
"name": {
Type: schema.TypeString,
Optional: true,
},
"extensions": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
"last_modified_by": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
Description: "This is an immutable reference to an entity. which mainly consists of id and name",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeInt,
Optional: true,
Description: "Identifier that uniquely identifies an entity",
},
"name": {
Type: schema.TypeString,
Optional: true,
},
"extensions": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
// "managed_by": {
// Type: schema.TypeSet,
// Optional: true,
// Computed: true,
// Description: "This is an immutable reference to an entity. which mainly consists of id and name",
// Elem: &schema.Resource{
// Schema: map[string]*schema.Schema{
// "id": {
// Type: schema.TypeInt,
// Optional: true,
// Description: "Identifier that uniquely identifies an entity",
// },
// "name": {
// Type: schema.TypeString,
// Optional: true,
// },
// "extensions": {
// Type: schema.TypeMap,
// Optional: true,
// Elem: &schema.Schema{
// Type: schema.TypeString,
// },
// },
// },
// },
// },
// "last_modified_by": {
// Type: schema.TypeSet,
// Optional: true,
// Computed: true,
// Description: "This is an immutable reference to an entity. which mainly consists of id and name",
// Elem: &schema.Resource{
// Schema: map[string]*schema.Schema{
// "id": {
// Type: schema.TypeInt,
// Optional: true,
// Description: "Identifier that uniquely identifies an entity",
// },
// "name": {
// Type: schema.TypeString,
// Optional: true,
// },
// "extensions": {
// Type: schema.TypeMap,
// Optional: true,
// Elem: &schema.Schema{
// Type: schema.TypeString,
// },
// },
// },
// },
// },
"comment": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -187,13 +187,13 @@ func resourceTrafficForwardingStaticIPRead(d *schema.ResourceData, m interface{}
_ = d.Set("routable_ip", resp.RoutableIP)
_ = d.Set("comment", resp.Comment)

if err := d.Set("managed_by", flattenStaticManagedBy(resp.ManagedBy)); err != nil {
return err
}
// if err := d.Set("managed_by", flattenStaticManagedBy(resp.ManagedBy)); err != nil {
// return err
// }

if err := d.Set("last_modified_by", flattenStaticLastModifiedBy(resp.LastModifiedBy)); err != nil {
return err
}
// if err := d.Set("last_modified_by", flattenStaticLastModifiedBy(resp.LastModifiedBy)); err != nil {
// return err
// }

return nil
}
Expand Down Expand Up @@ -268,18 +268,19 @@ func expandTrafficForwardingStaticIP(d *schema.ResourceData) staticips.StaticIP
RoutableIP: d.Get("routable_ip").(bool),
Comment: d.Get("comment").(string),
}
managedBy := expandStaticIPManagedBy(d)
if managedBy != nil {
result.ManagedBy = managedBy
}
// managedBy := expandStaticIPManagedBy(d)
// if managedBy != nil {
// result.ManagedBy = managedBy
// }

lastModifiedBy := expandStaticIPLastModifiedBy(d)
if lastModifiedBy != nil {
result.LastModifiedBy = lastModifiedBy
}
// lastModifiedBy := expandStaticIPLastModifiedBy(d)
// if lastModifiedBy != nil {
// result.LastModifiedBy = lastModifiedBy
// }
return result
}

/*
func expandStaticIPManagedBy(d *schema.ResourceData) *staticips.ManagedBy {
managedByObj, ok := d.GetOk("managed_by")
if !ok {
Expand Down Expand Up @@ -327,3 +328,4 @@ func expandStaticIPLastModifiedBy(d *schema.ResourceData) *staticips.LastModifie
}
return nil
}
*/

0 comments on commit 62dc031

Please sign in to comment.