aliyun / terraform-provider-alicloud

Terraform AliCloud provider
https://www.terraform.io/docs/providers/alicloud/
Mozilla Public License 2.0
591 stars 554 forks source link

[BUG] API Gateway - Terraform crash when adding constant_parameters #2276

Open yokzy88 opened 4 years ago

yokzy88 commented 4 years ago

Terraform crash when adding constant_parameters to the API Gateway API

Terraform Version

Terraform v0.12.17

Affected Resource(s)

Please list the resources as a list, for example:

Expected Behavior

Constant parameter should be created successfully

Actual Behavior

Terraform crash

Steps to Reproduce

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

  1. terraform apply image

Crash log snippet:

2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: panic: interface conversion: interface {} is nil, not string 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: goroutine 26 [running]: 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/terraform-providers/terraform-provider-alicloud/alicloud.setConstantParameters(0xc0002c8e70, 0xc000694000, 0x2, 0x2, 0xc00073c000, 0x2, 0x2, 0xc000a017c0, 0x2, 0x2, ...) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go:868 +0x9b8 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/terraform-providers/terraform-provider-alicloud/alicloud.setParameters(0xc0002c8e70, 0x4d85f0f, 0x13, 0x1, 0x0, 0x0, 0x0, 0x0, 0x20000c0006a4498, 0xffffffffffffffff, ...) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go:801 +0x156 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/terraform-providers/terraform-provider-alicloud/alicloud.resourceAliyunApigatewayApiUpdate(0xc0002c8e70, 0x4cc8400, 0xc000795680, 0x24, 0xae64f00) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go:516 +0x4b4 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0xc0005bd600, 0xc0000fcd70, 0xc0008e8560, 0x4cc8400, 0xc000795680, 0xc0006d3801, 0xc0006a44a0, 0x410a0c0) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:311 +0x26b 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0xc0005e6e00, 0xc000a0ba68, 0xc0000fcd70, 0xc0008e8560, 0xc0002ad7f8, 0xc0009de101, 0x410cca0) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x196 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0xc000532950, 0x5307260, 0xc000a02000, 0xc00013e600, 0xc000532950, 0xc000a02000, 0xc000927bd0) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:885 +0x88b 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x47d8d00, 0xc000532950, 0x5307260, 0xc000a02000, 0xc00013e5a0, 0x0, 0x5307260, 0xc000a02000, 0xc000822000, 0xb13) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3189 +0x245 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: google.golang.org/grpc.(Server).processUnaryRPC(0xc0002ea2c0, 0x537d8a0, 0xc0004f5200, 0xc00016e900, 0xc0005dbd10, 0xae338a0, 0x0, 0x0, 0x0) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/google.golang.org/grpc/server.go:995 +0x46d 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: google.golang.org/grpc.(Server).handleStream(0xc0002ea2c0, 0x537d8a0, 0xc0004f5200, 0xc00016e900, 0x0) 2020-03-19T02:40:24.050+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/google.golang.org/grpc/server.go:1275 +0xdad 2020-03-19T02:40:24.051+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: google.golang.org/grpc.(Server).serveStreams.func1.1(0xc00006e3d0, 0xc0002ea2c0, 0x537d8a0, 0xc0004f5200, 0xc00016e900) 2020-03-19T02:40:24.051+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/google.golang.org/grpc/server.go:710 +0xa6 2020-03-19T02:40:24.051+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: created by google.golang.org/grpc.(Server).serveStreams.func1 2020-03-19T02:40:24.051+0700 [DEBUG] plugin.terraform-provider-alicloud_v1.74.0_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-alicloud/vendor/google.golang.org/grpc/server.go:708 +0xa8 2020/03/19 02:40:24 [DEBUG] module.registration-api.alicloud_api_gateway_api.default_get_token: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalMaybeTainted 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalWriteState 2020/03/19 02:40:24 [TRACE] EvalWriteState: recording 1 dependencies for module.registration-api.alicloud_api_gateway_api.default_get_token 2020/03/19 02:40:24 [TRACE] EvalWriteState: writing current state object for module.registration-api.alicloud_api_gateway_api.default_get_token 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalApplyProvisioners 2020/03/19 02:40:24 [TRACE] EvalApplyProvisioners: alicloud_api_gateway_api.default_get_token is not freshly-created, so no provisioning is required 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalMaybeTainted 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalWriteState 2020/03/19 02:40:24 [TRACE] EvalWriteState: recording 1 dependencies for module.registration-api.alicloud_api_gateway_api.default_get_token 2020/03/19 02:40:24 [TRACE] EvalWriteState: writing current state object for module.registration-api.alicloud_api_gateway_api.default_get_token 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalIf 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalIf 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalWriteDiff 2020/03/19 02:40:24 [TRACE] module.registration-api: eval: terraform.EvalApplyPost 2020/03/19 02:40:24 [ERROR] module.registration-api: eval: terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing 2020/03/19 02:40:24 [ERROR] module.registration-api: eval: terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing 2020/03/19 02:40:24 [TRACE] [walkApply] Exiting eval tree: module.registration-api.alicloud_api_gateway_api.default_get_token 2020/03/19 02:40:24 [TRACE] vertex "module.registration-api.alicloud_api_gateway_api.default_get_token": visit complete 2020/03/19 02:40:24 [TRACE] dag/walk: upstream of "provider.alicloud (close)" errored, so skipping 2020/03/19 02:40:24 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping 2020/03/19 02:40:24 [TRACE] dag/walk: upstream of "root" errored, so skipping 2020/03/19 02:40:24 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2020/03/19 02:40:24 [TRACE] statemgr.Filesystem: no state changes since last snapshot 2020/03/19 02:40:24 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate 2020-03-19T02:40:24.062+0700 [DEBUG] plugin: plugin process exited: path="C:\Users\Arief Halim\gitlab\infrastructures\partner\test.terraform\plugins\windows_amd64\terraform-provider-alicloud_v1.74.0_x4.exe" pid=19804 error="exit status 2" 2020/03/19 02:40:24 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info 2020/03/19 02:40:24 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate 2020-03-19T02:40:24.084+0700 [DEBUG] plugin: plugin exited

yokzy88 commented 4 years ago

CMIIW, I think the root cause is in this line? Constant parameter doesn't require variable type

rsun-thoughtworks commented 3 years ago

Same here

greatbody commented 3 years ago

@yokzy88 I have fixed this bug, and PR have also been merged.

Just wait for the next release.

Which I also don't know when.

greatbody commented 3 years ago

@xiaozhu36 Hi. Thanks for the merge. Can you kindly share with us the next release date? Thanks,

rsun-thoughtworks commented 3 years ago

@xiaozhu36 Also, this is blocking our client who is using Alibaba, can your team release a new version today? Thanks!

xiaozhu36 commented 3 years ago

@rsun-thoughtworks @greatbody Yes, a new release will be published today, and I will let you know after it.

rsun-thoughtworks commented 3 years ago

@xiaozhu36 I noticed that your team have completed a release in github, however not yet published to terraform. image

rsun-thoughtworks commented 3 years ago

image

@xiaozhu36 Now its updated

greatbody commented 3 years ago

@yokzy88 This is resolved.

greatbody commented 3 years ago

@xiaozhu36 Please help close this issue.