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

backend/oss: Fixes the nil pointer panic error when missing access key or secret key #29784

Merged
merged 1 commit into from
Oct 20, 2021

Conversation

xiaozhu36
Copy link
Contributor

The PR aims to fix a invoking DescribeEndpoints panic error from missing required parameter access key or secret key.

TF_ACC=1 go test -v ./internal/backend/remote-state/oss/ -run=TestBackend -timeout 120m
=== RUN   TestBackend_impl
--- PASS: TestBackend_impl (0.00s)
=== RUN   TestBackendConfig
    backend_test.go:48: TestBackendConfig on *oss.Backend with configs.synthBody{Filename:"<TestWrapConfig>", Values:map[string]cty.Value{"bucket":cty.StringVal("terraform-backend-oss-test"), "key":cty.StringVal("first.tfstate"), "prefix":cty.StringVal("mystate"), "region":cty.StringVal("cn-beijing"), "tablestore_endpoint":cty.StringVal("https://terraformstate.cn-beijing.ots.aliyuncs.com"), "tablestore_table":cty.StringVal("TableStore")}}
--- PASS: TestBackendConfig (0.34s)
=== RUN   TestBackendConfigWorkSpace
    backend_test.go:83: TestBackendConfig on *oss.Backend with configs.synthBody{Filename:"<TestWrapConfig>", Values:map[string]cty.Value{"bucket":cty.StringVal("terraform-backend-oss-test-81"), "key":cty.StringVal("first.tfstate"), "prefix":cty.StringVal("mystate"), "region":cty.StringVal("cn-beijing"), "tablestore_endpoint":cty.StringVal("https://terraformstate.cn-beijing.ots.aliyuncs.com"), "tablestore_table":cty.StringVal("TableStore")}}
--- PASS: TestBackendConfigWorkSpace (1.79s)
=== RUN   TestBackendConfigProfile
    backend_test.go:122: TestBackendConfig on *oss.Backend with configs.synthBody{Filename:"<TestWrapConfig>", Values:map[string]cty.Value{"bucket":cty.StringVal("terraform-backend-oss-test"), "key":cty.StringVal("first.tfstate"), "prefix":cty.StringVal("mystate"), "profile":cty.StringVal("default"), "region":cty.StringVal("cn-beijing"), "tablestore_endpoint":cty.StringVal("https://terraformstate.cn-beijing.ots.aliyuncs.com"), "tablestore_table":cty.StringVal("TableStore")}}
--- PASS: TestBackendConfigProfile (0.16s)
=== RUN   TestBackendConfig_invalidKey
--- PASS: TestBackendConfig_invalidKey (0.00s)
=== RUN   TestBackend
    backend_test.go:168: TestBackendConfig on *oss.Backend with configs.synthBody{Filename:"<TestWrapConfig>", Values:map[string]cty.Value{"bucket":cty.StringVal("terraform-remote-oss-test-616fce6f"), "prefix":cty.StringVal("multi/level/path/")}}
    backend_test.go:173: TestBackendConfig on *oss.Backend with configs.synthBody{Filename:"<TestWrapConfig>", Values:map[string]cty.Value{"bucket":cty.StringVal("terraform-remote-oss-test-616fce6f"), "prefix":cty.StringVal("multi/level/path/")}}
    testing.go:299: TestBackend: testing state locking for *oss.Backend
    testing.go:299: TestBackend: *oss.Backend: empty string returned for lock, assuming disabled
    testing.go:299: TestBackend: testing state locking for *oss.Backend
    testing.go:299: TestBackend: *oss.Backend: empty string returned for lock, assuming disabled
--- PASS: TestBackend (2.09s)
PASS
ok      github.com/hashicorp/terraform/internal/backend/remote-state/oss        4.952s

@jbardin jbardin self-assigned this Oct 20, 2021
@jbardin jbardin added the 1.0-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Oct 20, 2021
@jbardin jbardin merged commit 0fcb750 into hashicorp:main Oct 20, 2021
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.0-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants