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

providers/alicloud: shouldn't access p.Service in GetConfig() #689

Merged
merged 1 commit into from
Dec 1, 2020

Conversation

cofyc
Copy link
Contributor

@cofyc cofyc commented Dec 1, 2020

fixes #681

why

p.Service is not initialized when we call GetConfig here:

https://github.com/GoogleCloudPlatform/terraformer/blob/master/cmd/import.go#L113-L116

and it's better to use p.profile field which is initialized in Init():

func (p *AliCloudProvider) Init(args []string) error {
p.region = args[0]
p.profile = args[1]
return nil
}

$ terraformer import alicloud --resources=* --profile=<xxx> --regions cn-hangzhou
2020/12/01 20:17:17 alicloud importing region cn-hangzhou
2020/12/01 20:17:17 Attempting an import of ALL resources in alicloud
2020/12/01 20:17:17 provider name: alicloud
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1998da1]

goroutine 1 [running]:
github.com/GoogleCloudPlatform/terraformer/providers/alicloud.(*AliCloudProvider).GetConfig(0xc000786730, 0x7471d77, 0x8, 0x1, 0x1)
	/data/go/src/github.com/GoogleCloudPlatform/terraformer/providers/alicloud/alicloud_provider.go:34 +0x41
github.com/GoogleCloudPlatform/terraformer/cmd.Import(0x7ce8ce0, 0xc000786730, 0xc000b3f700, 0xb, 0x10, 0xc0000787b0, 0x2a, 0x7474e4b, 0x9, 0x746c083, ...)
	/data/go/src/github.com/GoogleCloudPlatform/terraformer/cmd/import.go:97 +0x2e7
...

@cofyc
Copy link
Contributor Author

cofyc commented Dec 1, 2020

@sergeylanzman WDYT?

@sergeylanzman sergeylanzman merged commit 080649d into GoogleCloudPlatform:master Dec 1, 2020
@cofyc cofyc deleted the fix681 branch January 12, 2021 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to use it in alicloud? You can give me a tutorial
2 participants