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

managed_hsm: skip managed hsm auth build if not specified like in cn env #22400

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

wuxu92
Copy link
Contributor

@wuxu92 wuxu92 commented Jul 7, 2023

managedHSMAuth actually not used for now. it will be used for managed hsm data plane resources(which has not been merged to main now). managed HSM not suported in china regions (Expected GA in Q4 2023).

fixes: #22374

waiting for #22681 to update sdk.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check the Environment not the ResourceIdentifier here?

if err != nil {
return nil, fmt.Errorf("unable to build authorizer for Managed HSM API: %+v", err)
var managedHSMAuth auth.Authorizer
if _, ok := builder.AuthConfig.Environment.ManagedHSM.ResourceIdentifier(); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ResourceIdentifier is cloud agnostic - the Environment is cloud-specific, so we'll want to use that:

Suggested change
if _, ok := builder.AuthConfig.Environment.ManagedHSM.ResourceIdentifier(); ok {
if _, ok := builder.AuthConfig.Environment.ManagedHSM.Environment(); ok {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Api interface has no Environment() method

type Api interface {
AppId() (*string, bool)
DomainSuffix() (*string, bool)
Endpoint() (*string, bool)
Name() string
ResourceIdentifier() (*string, bool)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be implemented in the SDK, I've opened a PR to add an Available() method for APIs that we can use in the provider

@manicminer
Copy link
Contributor

@wuxu92 We added a new environments.Api.Available() method to the SDK that you can use here, it's available in v0.20230725.1160316 or later.

@wuxu92
Copy link
Contributor Author

wuxu92 commented Jul 27, 2023

@manicminer thank you! @tombuildsstuff updated with the Available method.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for this @wuxu92

@tombuildsstuff tombuildsstuff merged commit b67b8be into hashicorp:main Jul 28, 2023
@tombuildsstuff tombuildsstuff added this to the v3.68.0 milestone Jul 28, 2023
tombuildsstuff added a commit that referenced this pull request Jul 28, 2023
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 May 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to build authorizer for Managed HSM API when deploying to Azure China
3 participants