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

Terraform crashed when change backend from s3 to oss #24100

Open
liuyangc3 opened this issue Feb 13, 2020 · 0 comments
Open

Terraform crashed when change backend from s3 to oss #24100

liuyangc3 opened this issue Feb 13, 2020 · 0 comments

Comments

@liuyangc3
Copy link

liuyangc3 commented Feb 13, 2020

Terraform Version

Terraform v0.12.18
+ provider.alicloud v1.67.0

Terraform Configuration Files

Debug Output

Crash Output

cmd output

terraform init \
  -backend-config "bucket=terraform-bucket" \
  -backend-config "tablestore_table=terraform_table" \
  -backend-config "region=cn-zhangjiakou" \
  -backend-config "key=alicloud" \
  -backend-config "access_key=$TF_VAR_alicloud_access_key" \
  -backend-config "secret_key=$TF_VAR_alicloud_secret_key" \

Initializing the backend...
Backend configuration changed!

Terraform has detected that the configuration specified for the backend
has changed. Terraform will now check for existing state in the backends.


Terraform detected that the backend type changed from "s3" to "oss".
Do you want to migrate all workspaces to "oss"?
  Both the existing "s3" backend and the newly configured "oss" backend
  support workspaces. When migrating between backends, Terraform will copy
  all workspaces (with the same names). THIS WILL OVERWRITE any conflicting
  states in the destination.

  Terraform initialization doesn't currently migrate only select workspaces.
  If you want to migrate a select number of workspaces, you must manually
  pull and push those states.

  If you answer "yes", Terraform will migrate all states. If you answer
  "no", Terraform will abort.

  Enter a value: yes

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x2167a5f]

goroutine 1 [running]:
github.com/aliyun/aliyun-tablestore-go-sdk/tablestore.(*TableStoreClient).doRequestWithRetry(0x0, 0x2a3ceae, 0x7, 0x2ecc6e0, 0xc00022be50, 0x2ecc720, 0xc00081e640, 0xc000705f10, 0x0, 0xc0002013b8)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/pkg/mod/github.com/aliyun/aliyun-tablestore-go-sdk@v4.1.2+incompatible/tablestore/api.go:111 +0x3f
github.com/aliyun/aliyun-tablestore-go-sdk/tablestore.(*TableStoreClient).PutRow(0x0, 0xc000200b70, 0xc000200b88, 0x1, 0x1)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/pkg/mod/github.com/aliyun/aliyun-tablestore-go-sdk@v4.1.2+incompatible/tablestore/api.go:549 +0x262
github.com/hashicorp/terraform/backend/remote-state/oss.(*RemoteClient).Lock(0xc0003d4d20, 0xc00035e700, 0xc000200c50, 0x2, 0x2, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/backend/remote-state/oss/client.go:195 +0x414
github.com/hashicorp/terraform/backend/remote-state/oss.(*Backend).StateMgr(0xc000017200, 0xc000406045, 0xf, 0x2ef45c0, 0xc00051caa0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/backend/remote-state/oss/backend_state.go:140 +0x275
github.com/hashicorp/terraform/command.(*Meta).backendMigrateState_s_s(0xc0000fc380, 0xc0002555e0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend_migrate.go:239 +0x41e
github.com/hashicorp/terraform/command.(*Meta).backendMigrateState_S_S(0xc0000fc380, 0xc0002555e0, 0x1, 0x1)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend_migrate.go:171 +0x578
github.com/hashicorp/terraform/command.(*Meta).backendMigrateState(0xc0000fc380, 0xc0002555e0, 0x0, 0xc000201200)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend_migrate.go:107 +0x36c
github.com/hashicorp/terraform/command.(*Meta).backend_C_r_S_changed(0xc0000fc380, 0xc0004b1400, 0xfb0c6346, 0xc0001f9740, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend.go:825 +0x46d
github.com/hashicorp/terraform/command.(*Meta).backendFromConfig(0xc0000fc380, 0xc0001d5728, 0x0, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend.go:551 +0x8eb
github.com/hashicorp/terraform/command.(*Meta).Backend(0xc0000fc380, 0xc000201728, 0x0, 0xc0001d5700, 0x1, 0x1, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend.go:85 +0x599
github.com/hashicorp/terraform/command.(*InitCommand).initBackend(0xc0000fc380, 0xc00010f680, 0x2a4916f, 0xf, 0xc000484e40, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/init.go:473 +0x1bc
github.com/hashicorp/terraform/command.(*InitCommand).Run(0xc0000fc380, 0xc00003a100, 0xc, 0xc, 0xc00007b6c0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/init.go:287 +0x188d
github.com/mitchellh/cli.(*CLI).Run(0xc0000d6640, 0xc0000d6640, 0xc00054fcc0, 0x1)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/pkg/mod/github.com/mitchellh/cli@v1.0.0/cli.go:255 +0x1da
main.wrappedMain(0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/main.go:238 +0xc44
main.realMain(0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/main.go:102 +0xb4
main.main()
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/main.go:38 +0x3a



!!!!!!!!!!!!!!!!!!!!!!!!!!! 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.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

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

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

crash.log

2020/02/13 18:47:59 [INFO] Terraform version: 0.12.18
2020/02/13 18:47:59 [INFO] Go runtime version: go1.13.4
2020/02/13 18:47:59 [INFO] CLI args: []string{"/usr/local/bin/terraform", "init", "-backend-config", "bucket=f2pool-terraform-bucket", "-backend-config", "tablestore_table=f2pool_terraform_table", "-backend-config", "region=cn-zhangjiakou", "-
2020/02/13 18:47:59 [DEBUG] Attempting to open CLI config file: /Users/yang/.terraformrc
2020/02/13 18:47:59 Loading CLI configuration from /Users/yang/.terraformrc
2020/02/13 18:47:59 [INFO] Checkpoint disabled. Not running.
2020/02/13 18:47:59 [INFO] CLI command args: []string{"init", "-backend-config", "bucket=f2pool-terraform-bucket", "-backend-config", "tablestore_table=f2pool_terraform_table", "-backend-config", "region=cn-zhangjiakou", "-backend-config", 
2020/02/13 18:47:59 [TRACE] Meta.Backend: merging -backend-config=... CLI overrides into backend configuration
2020/02/13 18:47:59 [TRACE] Meta.Backend: built configuration for "oss" backend with hash value 4211893062
2020/02/13 18:47:59 [TRACE] Preserving existing state lineage "9b89f607-8419-a986-cc1d-54f3bb66fa87"
2020/02/13 18:47:59 [TRACE] Preserving existing state lineage "9b89f607-8419-a986-cc1d-54f3bb66fa87"
2020/02/13 18:47:59 [TRACE] Meta.Backend: working directory was previously initialized for "s3" backend
2020/02/13 18:47:59 [TRACE] backendConfigNeedsMigration: type changed from "s3" to "oss", so migration is required
2020/02/13 18:47:59 [TRACE] Meta.Backend: backend configuration has changed (from type "s3" to type "oss")
2020/02/13 18:47:59 [WARN] backend config has changed since last init
2020/02/13 18:48:02 [DEBUG] Instantiate OSS client using endpoint: "https://oss-cn-zhangjiakou.aliyuncs.com"
2020/02/13 18:48:02 [TRACE] Preserving existing state lineage "9b89f607-8419-a986-cc1d-54f3bb66fa87"
2020/02/13 18:48:02 [TRACE] Preserving existing state lineage "9b89f607-8419-a986-cc1d-54f3bb66fa87"
2020/02/13 18:48:02 [TRACE] Preserving existing state lineage "9b89f607-8419-a986-cc1d-54f3bb66fa87"
2020/02/13 18:48:02 [INFO] Setting AWS metadata API timeout to 100ms
2020/02/13 18:48:02 [INFO] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
2020/02/13 18:48:02 [INFO] AWS Auth provider used: "StaticProvider"
2020/02/13 18:48:02 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/13 18:48:05 [TRACE] backendMigrateState: need to migrate from "s3" to "oss" backend config
2020/02/13 18:48:15 [TRACE] backendMigrateState: migrating all named workspaces
2020/02/13 18:48:15 [DEBUG] command: asking for input: "Do you want to migrate all workspaces to \"oss\"?"
2020/02/13 18:48:55 [TRACE] backendMigrateState: migrating "aion-production" workspace to "aion-production" workspace
2020/02/13 18:49:02 [DEBUG] Current workspace name: aion-production. All workspaces:[]string{"default"}
2020/02/13 18:49:02 [DEBUG] Recoring state lock in tablestore: &tablestore.PutRowChange{TableName:"f2pool_terraform_table", PrimaryKey:(*tablestore.PrimaryKey)(0xc0001d4860), Columns:[]tablestore.AttributeColumn{tablestore.AttributeColumn{ColumnName:"LockID", Value:"env:/aion-production/alicloud.tflock", Timestamp:0}, tablestore.AttributeColumn{ColumnName:"Info", Value:"{\"ID\":\"96bdf33d-b149-edd1-beba-c72b7765dcb6\",\"Operation\":\"init\",\"Info\":\"\",\"Who\":\"yang@yangdeMacBook-Pro.local\",\"Version\":\"0.12.18\",\"Created\":\"2020-02-13T10:49:02.441835Z\",\"Path\":\"\"}", Timestamp:0}}, Condition:(*tablestore.RowCondition)(0xc0001d4880), ReturnType:0, TransactionId:(*string)(nil)}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x2167a5f]

goroutine 1 [running]:
github.com/aliyun/aliyun-tablestore-go-sdk/tablestore.(*TableStoreClient).doRequestWithRetry(0x0, 0x2a3ceae, 0x7, 0x2ecc6e0, 0xc00022be50, 0x2ecc720, 0xc00081e640, 0xc000705f10, 0x0, 0xc0002013b8)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/pkg/mod/github.com/aliyun/aliyun-tablestore-go-sdk@v4.1.2+incompatible/tablestore/api.go:111 +0x3f
github.com/aliyun/aliyun-tablestore-go-sdk/tablestore.(*TableStoreClient).PutRow(0x0, 0xc000200b70, 0xc000200b88, 0x1, 0x1)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/pkg/mod/github.com/aliyun/aliyun-tablestore-go-sdk@v4.1.2+incompatible/tablestore/api.go:549 +0x262
github.com/hashicorp/terraform/backend/remote-state/oss.(*RemoteClient).Lock(0xc0003d4d20, 0xc00035e700, 0xc000200c50, 0x2, 0x2, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/backend/remote-state/oss/client.go:195 +0x414
github.com/hashicorp/terraform/backend/remote-state/oss.(*Backend).StateMgr(0xc000017200, 0xc000406045, 0xf, 0x2ef45c0, 0xc00051caa0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/backend/remote-state/oss/backend_state.go:140 +0x275
github.com/hashicorp/terraform/command.(*Meta).backendMigrateState_s_s(0xc0000fc380, 0xc0002555e0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend_migrate.go:239 +0x41e
github.com/hashicorp/terraform/command.(*Meta).backendMigrateState_S_S(0xc0000fc380, 0xc0002555e0, 0x1, 0x1)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend_migrate.go:171 +0x578
github.com/hashicorp/terraform/command.(*Meta).backendMigrateState(0xc0000fc380, 0xc0002555e0, 0x0, 0xc000201200)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend_migrate.go:107 +0x36c
github.com/hashicorp/terraform/command.(*Meta).backend_C_r_S_changed(0xc0000fc380, 0xc0004b1400, 0xfb0c6346, 0xc0001f9740, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend.go:825 +0x46d
github.com/hashicorp/terraform/command.(*Meta).backendFromConfig(0xc0000fc380, 0xc0001d5728, 0x0, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend.go:551 +0x8eb
github.com/hashicorp/terraform/command.(*Meta).Backend(0xc0000fc380, 0xc000201728, 0x0, 0xc0001d5700, 0x1, 0x1, 0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/meta_backend.go:85 +0x599
github.com/hashicorp/terraform/command.(*InitCommand).initBackend(0xc0000fc380, 0xc00010f680, 0x2a4916f, 0xf, 0xc000484e40, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/init.go:473 +0x1bc
github.com/hashicorp/terraform/command.(*InitCommand).Run(0xc0000fc380, 0xc00003a100, 0xc, 0xc, 0xc00007b6c0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/command/init.go:287 +0x188d
github.com/mitchellh/cli.(*CLI).Run(0xc0000d6640, 0xc0000d6640, 0xc00054fcc0, 0x1)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/pkg/mod/github.com/mitchellh/cli@v1.0.0/cli.go:255 +0x1da
main.wrappedMain(0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/main.go:238 +0xc44
main.realMain(0x0)
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/main.go:102 +0xb4
main.main()
	/private/tmp/terraform-20191211-22054-16ritod/terraform-0.12.18/src/github.com/hashicorp/terraform/main.go:38 +0x3a

Expected Behavior

Actual Behavior

Steps to Reproduce

terraform init

Additional Context

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants