Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firewall app rules #2532

Merged
merged 18 commits into from
Jan 4, 2019
Prev Previous commit
Next Next commit
use list instead of set
  • Loading branch information
hbuckle committed Dec 7, 2018
commit 0a92f11b3d6db5270a134fb5474ea995a037757b
9 changes: 4 additions & 5 deletions azurerm/resource_arm_firewall_application_rule_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func resourceArmFirewallApplicationRuleCollection() *schema.Resource {
},

"rule": {
Type: schema.TypeSet,
Type: schema.TypeList,
Required: true,
MinItems: 1,
Elem: &schema.Resource{
Expand Down Expand Up @@ -149,7 +149,7 @@ func resourceArmFirewallApplicationRuleCollectionCreateUpdate(d *schema.Resource
}
ruleCollections := *props.ApplicationRuleCollections

applicationRules := expandArmFirewallApplicationRules(d.Get("rule").(*schema.Set))
applicationRules := expandArmFirewallApplicationRules(d.Get("rule").([]interface{}))
priority := d.Get("priority").(int)
newRuleCollection := network.AzureFirewallApplicationRuleCollection{
Name: utils.String(name),
Expand Down Expand Up @@ -289,7 +289,6 @@ func resourceArmFirewallApplicationRuleCollectionRead(d *schema.ResourceData, me
}

flattenedRules := flattenFirewallApplicationRuleCollectionRules(props.Rules)
// if err := d.Set("rule", schema.NewSet(resourceArmFirewallApplicationRuleCollectionRuleProtocolHash, flattenedRules)); err != nil {
if err := d.Set("rule", flattenedRules); err != nil {
return fmt.Errorf("Error setting `rule`: %+v", err)
}
Expand Down Expand Up @@ -357,10 +356,10 @@ func resourceArmFirewallApplicationRuleCollectionDelete(d *schema.ResourceData,
return nil
}

func expandArmFirewallApplicationRules(inputs *schema.Set) []network.AzureFirewallApplicationRule {
func expandArmFirewallApplicationRules(inputs []interface{}) []network.AzureFirewallApplicationRule {
outputs := make([]network.AzureFirewallApplicationRule, 0)

for _, input := range inputs.List() {
for _, input := range inputs {
rule := input.(map[string]interface{})

ruleName := rule["name"].(string)
Expand Down