Skip to content

Commit

Permalink
Add network policy config.
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-henderson committed Mar 15, 2018
1 parent 877cd21 commit 0e24782
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
"network_policy_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"disabled": {
Type: schema.TypeBool,
Optional: true,
},
},
},
},
},
},
},
Expand Down Expand Up @@ -1182,6 +1196,15 @@ func expandClusterAddonsConfig(configured interface{}) *containerBeta.AddonsConf
ForceSendFields: []string{"Disabled"},
}
}

if v, ok := config["network_policy_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.NetworkPolicyConfig = &containerBeta.NetworkPolicyConfig{
Disabled: addon["disabled"].(bool),
ForceSendFields: []string{"Disabled"},
}
}

return ac
}

Expand Down Expand Up @@ -1299,6 +1322,14 @@ func flattenClusterAddonsConfig(c *containerBeta.AddonsConfig) []map[string]inte
},
}
}
if c.NetworkPolicyConfig != nil {
result["network_policy_config"] = []map[string]interface{}{
{
"disabled": c.NetworkPolicyConfig.Disabled,
},
}
}

return []map[string]interface{}{result}
}

Expand Down

0 comments on commit 0e24782

Please sign in to comment.