Skip to content

feat(oss backend): support aliyun/credentials-go SDK for authentication - #2

Open
twilight-cui wants to merge 2 commits into
mainfrom
feat/oss-credentials-go
Open

feat(oss backend): support aliyun/credentials-go SDK for authentication#2
twilight-cui wants to merge 2 commits into
mainfrom
feat/oss-credentials-go

Conversation

@twilight-cui

Copy link
Copy Markdown
Collaborator

Add an opt-in authentication path via the aliyun/credentials-go SDK alongside the existing access_key/assume_role logic, controlled by a new use_credentials_go switch and a credential_type selector.

Supported credential_type values:

  • access_key
  • sts
  • ecs_ram_role
  • ram_role_arn
  • oidc_role_arn
  • credentials_uri
  • (empty) credentials-go default provider chain

All credentials-go invocation is isolated in the new credentials.go so backend.go changes are minimal: a few schema fields and a single if/else branch wrapping the pre-existing ecs_role/assume_role code. region resolution and endpoint/OTS client construction are reused as is.

Fixes #

Target Release

1.17.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

Add an opt-in authentication path via the aliyun/credentials-go SDK
alongside the existing access_key/assume_role logic, controlled by a
new `use_credentials_go` switch and a `credential_type` selector.

Supported credential_type values:
  - access_key
  - sts
  - ecs_ram_role
  - ram_role_arn
  - oidc_role_arn
  - credentials_uri
  - (empty) credentials-go default provider chain

All credentials-go invocation is isolated in the new credentials.go so
backend.go changes are minimal: a few schema fields and a single
if/else branch wrapping the pre-existing ecs_role/assume_role code.
region resolution and endpoint/OTS client construction are reused as
is.
…ials block

Replace the boolean  top-level switch with an opt-in
optional  block. When the block is present, the backend
authenticates via the aliyun/credentials-go SDK using the block's fields;
otherwise the traditional access_key / assume_role path is used.

- Move the credentials-go-only fields (credential_type, oidc_provider_arn,
  oidc_token_file_path, external_id, credentials_uri, disable_imds_v1)
  from top-level into the  block, alongside shared fields
  (access_key, secret_key, security_token, ecs_role_name, assume_role_*,
  sts_endpoint) duplicated for the block.
- Inner fields keep their EnvDefaultFunc, so env-var usage still works once
  the block is declared (an empty  block triggers the
  credentials-go default provider chain).
- configure() now keys off  instead of the removed
  use_credentials_go bool.
- getCredentialsFromCredentialsGo now takes a map[string]interface{} from
  the block rather than a *schema.ResourceData; add getCred* helpers.
- Fix a latent bug: disable_imds_v1 no longer sets both Default and
  DefaultFunc (Default would silently shadow DefaultFunc in DefaultValue).
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.

1 participant