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

Crash in terraform plan when comparing to nsg rule with IP list #464

Closed
clippermadness opened this issue Oct 27, 2017 · 6 comments
Closed

Comments

@clippermadness
Copy link

clippermadness commented Oct 27, 2017

Terraform Version

0.10.7

Affected Resource(s)

  • azurerm_network_security_group

Expected Behavior

Should have tried to delete the rule, since it's in Azure but not in my config.
When I remove the rule from Azure, terraform plan does not crash.

Actual Behavior

Crash:

2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:       {
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:         "name": "AllowSpaceShackInboundToSSH",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:         "id": "/subscriptions/5e384bd8-c8ba-4040-b29d-4e37a8921981/resourceGroups/development/providers/Microsoft.Network/networkSecurityGroups/pipeline_pipelinetier_dev/securityRules/AllowSpaceShackInboundToSSH",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:         "etag": "W/\"473bd9ba-d56b-4d26-80bf-8984563c7042\"",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:         "properties": {
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "provisioningState": "Succeeded",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "protocol": "TCP",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "sourcePortRange": "*",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "destinationPortRange": "22",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "destinationAddressPrefix": "*",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "access": "Allow",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "priority": 100,
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "direction": "Inbound",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "sourcePortRanges": [],
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "destinationPortRanges": [],
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "sourceAddressPrefixes": [
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "79.241.57.185/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "79.241.57.188/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "90.187.21.13/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "91.64.3.188/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "90.187.22.125/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "84.190.180.70/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "79.241.57.187/32",
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:             "79.241.57.35/32"
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           ],
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:           "destinationAddressPrefixes": []
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:         }
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:       }
2017-10-27T10:28:47.048-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4:     ],
panic: runtime error: invalid memory address or nil pointer dereference
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1e4ab9d]
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: goroutine 129 [running]:
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: github.com/terraform-providers/terraform-provider-azurerm/azurerm.flattenNetworkSecurityRules(0xc420836b60, 0x21d905a, 0x8, 0x1fc56e0)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_network_security_group.go:231 +0x41d
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmNetworkSecurityGroupRead(0xc42029a000, 0x210aba0, 0xc4201ee000, 0x0, 0x2bce4c0)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_network_security_group.go:196 +0x576
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc4203288a0, 0xc42018e0f0, 0x210aba0, 0xc4201ee000, 0xc420315980, 0xc4204cda01, 0x80000000018)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:321 +0x199
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc4203ac000, 0xc42018e050, 0xc42018e0f0, 0x30bad90, 0x0, 0x18)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:284 +0x9a
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc420148aa0, 0xc4206a4010, 0xc4206a4370, 0x0, 0x0)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:510 +0x4e
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: reflect.Value.call(0xc42030c840, 0xc4201780e0, 0x13, 0x21d4780, 0x4, 0xc4202e3f20, 0x3, 0x3, 0x0, 0x0, ...)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/usr/local/go/src/reflect/value.go:434 +0x906
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: reflect.Value.Call(0xc42030c840, 0xc4201780e0, 0x13, 0xc42002d720, 0x3, 0x3, 0xc420350600, 0x0, 0xc)
2017-10-27T10:28:47.051-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/usr/local/go/src/reflect/value.go:302 +0xa4
2017-10-27T10:28:47.052-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: net/rpc.(*service).call(0xc420184980, 0xc4205ec000, 0xc4201c2080, 0xc42017a500, 0xc420149040, 0x1f87d80, 0xc4206a4010, 0x16, 0x1f87dc0, 0xc4206a4370, ...)
2017-10-27T10:28:47.052-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/usr/local/go/src/net/rpc/server.go:381 +0x142
2017-10-27T10:28:47.052-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: created by net/rpc.(*Server).ServeCodec
2017-10-27T10:28:47.052-0700 [DEBUG] plugin.terraform-provider-azurerm_v0.3.1_x4: 	/usr/local/go/src/net/rpc/server.go:475 +0x36b
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalRefresh, err: azurerm_network_security_group.pipeline_elasticsearchtier_dev: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalRefresh, err: azurerm_storage_account.thetalakedevelopmentq: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalRefresh, err: azurerm_storage_account.thetalakedevelopment: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalRefresh, err: azurerm_public_ip.elasticsearch_dev2_ip: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalRefresh, err: azurerm_public_ip.pipeline_dev2_ip: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalSequence, err: azurerm_public_ip.elasticsearch_dev2_ip: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalSequence, err: azurerm_public_ip.pipeline_dev2_ip: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalSequence, err: azurerm_network_security_group.pipeline_elasticsearchtier_dev: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalSequence, err: azurerm_storage_account.thetalakedevelopment: unexpected EOF
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: azurerm_network_security_group.pipeline_elasticsearchtier_dev
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: azurerm_storage_account.thetalakedevelopment
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalSequence, err: azurerm_storage_account.thetalakedevelopmentq: unexpected EOF
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: azurerm_storage_account.thetalakedevelopmentq
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalRefresh, err: azurerm_network_security_group.pipeline_pipelinetier_dev: unexpected EOF
2017/10/27 10:28:47 [ERROR] root: eval: *terraform.EvalSequence, err: azurerm_network_security_group.pipeline_pipelinetier_dev: unexpected EOF
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: azurerm_network_security_group.pipeline_pipelinetier_dev
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_storage_queue.pipeline_dev2_vid_faces_queue"
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: azurerm_public_ip.elasticsearch_dev2_ip
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_storage_queue.pipeline_dev2_vid_queue"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_storage_queue.pipeline_dev2_queue"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_storage_queue.pipeline_dev2_aud_queue"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_storage_queue.pipeline_dev2_vid_frames_queue"
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: azurerm_public_ip.pipeline_dev2_ip
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_network_interface.elasticsearch_dev2_nic"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_network_interface.pipeline_dev2_nic"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_virtual_machine.elasticsearch_dev2"
2017-10-27T10:28:47.055-0700 [DEBUG] plugin: plugin process exited: path=/Users/rich/infrastructure/terraform/pipeline/dev/dev2/.terraform/plugins/darwin_amd64/terraform-provider-azurerm_v0.3.1_x4
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "azurerm_virtual_machine.pipeline_dev2"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "provider.azurerm (close)"
2017/10/27 10:28:47 [TRACE] root: eval: *terraform.EvalWriteState
2017/10/27 10:28:47 [TRACE] root: eval: *terraform.EvalUpdateStateHook
2017/10/27 10:28:47 [TRACE] [walkRefresh] Exiting eval tree: data.aws_route53_zone.thetalake_com
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "aws_route53_record.elasticsearch_dev2"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "aws_route53_record.pipeline_dev2"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2017/10/27 10:28:47 [TRACE] dag/walk: upstream errored, not walking "root"
2017/10/27 10:28:47 [DEBUG] plugin: waiting for all plugin processes to complete...
2017-10-27T10:28:47.256-0700 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2017-10-27T10:28:47.260-0700 [DEBUG] plugin: plugin process exited: path=/Users/rich/infrastructure/terraform/pipeline/dev/dev2/.terraform/plugins/darwin_amd64/terraform-provider-aws_v1.1.0_x4



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Create a nsg rule in the Aure portal that specifies a list of IPs as CIDR blocks, i.e. 1.2.3.4/32
@madenwala
Copy link
Contributor

Can you share a TF script for me so that I can reproduce?

@madenwala
Copy link
Contributor

Really need your TF script. I don't see a way to add multiple IP addresses to the source_address_prefix property. Also do you have the latest terraform and azure provider?

@clippermadness
Copy link
Author

The issue can be reproduced by going into the Azure portal and creating an IP list manually, not through terraform and the AzureRM provider. If you do that, then a terraform plan where the IP list is not part of your managed resources causes the crash.

@madenwala
Copy link
Contributor

OK, thank you for the clarification! I was able to reproduce your bug...investigating now...

madenwala added a commit that referenced this issue Nov 3, 2017
@tombuildsstuff
Copy link
Contributor

Fixed in #492

@ghost
Copy link

ghost commented Apr 1, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
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

4 participants