From 1035f96566248d80e6e52adca3e576567fff7c54 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Tue, 24 Dec 2024 18:06:39 +0800 Subject: [PATCH] add --- tencentcloud/provider.go | 14 +++++++------- website/docs/index.html.markdown | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 668535a624..9cb8bb9128 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -271,13 +271,13 @@ func Provider() *schema.Provider { Type: schema.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc(PROVIDER_ASSUME_ROLE_SAML_ASSERTION, nil), - Description: "SAML assertion information encoded in base64. It can be sourced from the `PROVIDER_ASSUME_ROLE_SAML_ASSERTION`.", + Description: "SAML assertion information encoded in base64. It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SAML_ASSERTION`.", }, "principal_arn": { Type: schema.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc(PROVIDER_ASSUME_ROLE_PRINCIPAL_ARN, nil), - Description: "Player Access Description Name. It can be sourced from the `PROVIDER_ASSUME_ROLE_PRINCIPAL_ARN`.", + Description: "Player Access Description Name. It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_PRINCIPAL_ARN`.", }, "role_arn": { Type: schema.TypeString, @@ -323,7 +323,7 @@ func Provider() *schema.Provider { Type: schema.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc(PROVIDER_ASSUME_ROLE_WEB_IDENTITY_TOKEN, nil), - Description: "OIDC token issued by IdP. It can be sourced from the `PROVIDER_ASSUME_ROLE_WEB_IDENTITY_TOKEN`.", + Description: "OIDC token issued by IdP. It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_WEB_IDENTITY_TOKEN`.", }, "role_arn": { Type: schema.TypeString, @@ -2340,12 +2340,12 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { ) // get assume role from credential - if providerConfig["role-arn"] != nil { - assumeRoleArn = providerConfig["role-arn"].(string) + if v, ok := providerConfig["role-arn"].(string); ok && v != "" { + assumeRoleArn = v } - if providerConfig["role-session-name"] != nil { - assumeRoleSessionName = providerConfig["role-session-name"].(string) + if v, ok := providerConfig["role-session-name"].(string); ok && v != "" { + assumeRoleSessionName = v } if assumeRoleArn != "" && assumeRoleSessionName != "" { diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 8807e93529..514301b68e 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -395,11 +395,11 @@ The nested `assume_role_with_saml` block supports the following: * `role_arn` - (Required) The ARN of the role to assume. It can also be sourced from the `TENCENTCLOUD_ASSUME_ROLE_ARN` environment variable. * `session_name` - (Required) The session name to use when making the AssumeRole call. It can also be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME` environment variable. * `session_duration` - (Required) The duration of the session when making the AssumeRole call. Its value ranges from 0 to 43200(seconds), and default is 7200 seconds. It can also be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION` environment variable. -* `saml_assertion` - (Required) SAML assertion information encoded in base64. It can be sourced from the `PROVIDER_ASSUME_ROLE_SAML_ASSERTION`. -* `principal_arn` - (Required) Player Access Description Name. It can be sourced from the `PROVIDER_ASSUME_ROLE_PRINCIPAL_ARN`. +* `saml_assertion` - (Required) SAML assertion information encoded in base64. It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SAML_ASSERTION`. +* `principal_arn` - (Required) Player Access Description Name. It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_PRINCIPAL_ARN`. The nested `assume_role_with_web_identity` block supports the following: * `role_arn` - (Required) The ARN of the role to assume. It can also be sourced from the `TENCENTCLOUD_ASSUME_ROLE_ARN` environment variable. * `session_name` - (Required) The session name to use when making the AssumeRole call. It can also be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME` environment variable. * `session_duration` - (Required) The duration of the session when making the AssumeRole call. Its value ranges from 0 to 43200(seconds), and default is 7200 seconds. It can also be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION` environment variable. -* `web_identity_token` - (Required) OIDC token issued by IdP. It can be sourced from the `PROVIDER_ASSUME_ROLE_WEB_IDENTITY_TOKEN`. +* `web_identity_token` - (Required) OIDC token issued by IdP. It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_WEB_IDENTITY_TOKEN`.