Skip to content

Commit

Permalink
Update state setting of iec network acl (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lance52259 authored Jan 27, 2021
1 parent 9d8eb64 commit e29a103
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions huaweicloud/resource_huaweicloud_iec_network_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ func resourceIecNetworkACLRead(d *schema.ResourceData, meta interface{}) error {
d.Set("description", fwGroup.Description)
d.Set("inbound_rules", getFirewallRuleIDs(fwGroup.IngressFWPolicy))
d.Set("outbound_rules", getFirewallRuleIDs(fwGroup.EgressFWPolicy))
var networkSet []map[string]interface{}
for _, val := range fwGroup.Subnets {
subnet := make(map[string]interface{})
subnet["vpc_id"] = val.VpcID
subnet["subnet_id"] = val.ID
networkSet = append(networkSet, subnet)
}
if err = d.Set("networks", networkSet); err != nil {
return fmt.Errorf("Saving iec networks failed: %s", err)
}

return nil
}
Expand Down
5 changes: 5 additions & 0 deletions huaweicloud/resource_huaweicloud_iec_network_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func TestAccIecNetworkACLResource_basic(t *testing.T) {
testAccCheckIecNetworkACLNetBlockExists(&fwGroup),
),
},
{
ResourceName: resourceKey,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccIecNetworkACL_basic_update(rName),
Check: resource.ComposeTestCheckFunc(
Expand Down

0 comments on commit e29a103

Please sign in to comment.