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

Update property from list to set for app gw #7021

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions azurerm/internal/services/network/application_gateway_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func resourceArmApplicationGateway() *schema.Resource {

// Required
"backend_address_pool": {
Type: schema.TypeList,
Type: schema.TypeSet,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -140,7 +140,7 @@ func resourceArmApplicationGateway() *schema.Resource {
},

"backend_http_settings": {
Type: schema.TypeList,
Type: schema.TypeSet,
Required: true,
MinItems: 1,
Elem: &schema.Resource{
Expand Down Expand Up @@ -367,7 +367,7 @@ func resourceArmApplicationGateway() *schema.Resource {
},

"http_listener": {
Type: schema.TypeList,
Type: schema.TypeSet,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -987,8 +987,7 @@ func resourceArmApplicationGateway() *schema.Resource {
},

"ssl_certificate": {
// TODO: should this become a Set?
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -1828,7 +1827,7 @@ func flattenApplicationGatewayTrustedRootCertificates(certs *[]network.Applicati
}

func expandApplicationGatewayBackendAddressPools(d *schema.ResourceData) *[]network.ApplicationGatewayBackendAddressPool {
vs := d.Get("backend_address_pool").([]interface{})
vs := d.Get("backend_address_pool").(*schema.Set).List()
results := make([]network.ApplicationGatewayBackendAddressPool, 0)

for _, raw := range vs {
Expand Down Expand Up @@ -1903,7 +1902,7 @@ func flattenApplicationGatewayBackendAddressPools(input *[]network.ApplicationGa

func expandApplicationGatewayBackendHTTPSettings(d *schema.ResourceData, gatewayID string) *[]network.ApplicationGatewayBackendHTTPSettings {
results := make([]network.ApplicationGatewayBackendHTTPSettings, 0)
vs := d.Get("backend_http_settings").([]interface{})
vs := d.Get("backend_http_settings").(*schema.Set).List()

for _, raw := range vs {
v := raw.(map[string]interface{})
Expand Down Expand Up @@ -2203,7 +2202,7 @@ func flattenApplicationGatewaySslPolicy(input *network.ApplicationGatewaySslPoli
}

func expandApplicationGatewayHTTPListeners(d *schema.ResourceData, gatewayID string) (*[]network.ApplicationGatewayHTTPListener, error) {
vs := d.Get("http_listener").([]interface{})
vs := d.Get("http_listener").(*schema.Set).List()
results := make([]network.ApplicationGatewayHTTPListener, 0)

for _, raw := range vs {
Expand Down Expand Up @@ -3203,7 +3202,7 @@ func flattenApplicationGatewaySku(input *network.ApplicationGatewaySku) []interf
}

func expandApplicationGatewaySslCertificates(d *schema.ResourceData) (*[]network.ApplicationGatewaySslCertificate, error) {
vs := d.Get("ssl_certificate").([]interface{})
vs := d.Get("ssl_certificate").(*schema.Set).List()
results := make([]network.ApplicationGatewaySslCertificate, 0)

for _, raw := range vs {
Expand Down Expand Up @@ -3275,7 +3274,7 @@ func flattenApplicationGatewaySslCertificates(input *[]network.ApplicationGatewa

// since the certificate data isn't returned we have to load it from the same index
if existing, ok := d.GetOk("ssl_certificate"); ok && existing != nil {
existingVals := existing.([]interface{})
existingVals := existing.(*schema.Set).List()
for _, existingVal := range existingVals {
existingCerts := existingVal.(map[string]interface{})
existingName := existingCerts["name"].(string)
Expand Down