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

v0.12: Phantom nil element appear in some configs during AzureRm tests #20585

Closed
katbyte opened this issue Mar 6, 2019 · 7 comments
Closed
Milestone

Comments

@katbyte
Copy link
Contributor

katbyte commented Mar 6, 2019

Hello,

We are experiencing some weird panics in the azurerm provider after updating to the latest .12 SDK (master): github.com/hashicorp/terraform v0.12.0-alpha4.0.20190306001855-b9d8e96e0c7c

It appears a in a few different places we are getting nil elements inside slices that should by all accounts be empty (as well as some other less clear failures that might be related). The branch and some information can be seen at hashicorp/terraform-provider-azurerm#2968 but the two obvious instances are:

aks:

=== CONT  TestAccAzureRMKubernetesCluster_addAgent
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 622 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm.expandKubernetesClusterAddonProfiles(0xc000a4f5e0, 0xc00181c300)
	/Users/kt/hashi/go/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_kubernetes_cluster.go:752 +0x93f

code

profiles := d.Get("addon_profile").([]interface{})
	if len(profiles) == 0 {
		return nil
	}

	profile := profiles[0].(map[string]interface{})

and addon_profile is not set in the config

the second instance is in a bunch of VM tests:

=== CONT  TestAccAzureRMVirtualMachineScaleSet_linuxUpdated
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 847 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm.expandAzureRmVirtualMachineScaleSetNetworkProfile(0xc0018744d0, 0x0)
	/Users/kt/hashi/go/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_virtual_machine_scale_set.go:1630 +0x1f94

code

dnsSettingsConfigs := config["dns_settings"].([]interface{})
		dnsSettings := compute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{}
		for _, dnsSettingsConfig := range dnsSettingsConfigs {
			dns_settings := dnsSettingsConfig.(map[string]interface{})

and dns_settings is also not set in the config

@ghost ghost added bug crash labels Mar 6, 2019
@mildwonkey mildwonkey added this to the v0.12.0 milestone Mar 6, 2019
@jbardin
Copy link
Member

jbardin commented Mar 7, 2019

Hi @katbyte,

I'm going to start with just the first example here. You will probably find slightly different behavior with master now, since there was a change just merged that's going to alter the handling of "computed blocks". I'm not sure if it's going to be better or worse, since there isn't any defined behavior for this schema. We're tolerating schemas containing "computed" blocks for now with some limitations, but there's no real way to handle one which also contains required fields.

I think removing the Computed: true field from the addon_profile schema will improve the situation.

I'll follow up with more info on the other cases too.

@jbardin
Copy link
Member

jbardin commented Mar 7, 2019

I wasn't able to get the Azure ACC tests running locally, but I managed to create a reproduction of the first issue. The most recent master seems to alleviate the issue, and I haven't been able to replicate any nil values in that structure with the new object normalization in place.

@jbardin
Copy link
Member

jbardin commented Mar 9, 2019

OK, no need to check master at the moment. The change that removed the panics causes issues with other unusual provider schemas, so I'll find another way to resolve those.

@katbyte
Copy link
Contributor Author

katbyte commented Mar 11, 2019

Thanks for the updates @jbardin

@jbardin
Copy link
Member

jbardin commented Mar 13, 2019

The TestAccAzureRMVirtualMachineScaleSet_linuxUpdated now passes locally for me.
I'm not sure about the k8s test (not idea how long that's supposed to take), but I think the cases causing the panics have been cleared up.

@jbardin
Copy link
Member

jbardin commented Mar 15, 2019

Ok, had time to verify both tests are passing now with master.

@jbardin jbardin closed this as completed Mar 15, 2019
@ghost
Copy link

ghost commented Aug 13, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants