HUAWEI CLOUD Provider Authentication
HUAWEI CLOUD Provider uses AK/SK for authentication. You can provide credentials as either static credentials or environment variables.
Static Credentials
Configure parameters region, access_key, and secret_key in the provider block. For example:
provider "huaweicloud" {
region = "cn-north-1"
access_key = "my-access-key"
secret_key = "my-secret-key"
}
Static credentials are simple to use. However, they require AKs and SKs to be stored in configuration files in plaintext, which risks secret leakage. It is recommended that you provide credentials as environment variables.
Environment Variables
Configure the region, AK, and SK as environment variables. For example:
$ export HW_REGION_NAME="cn-north-1" $ export HW_ACCESS_KEY="my-access-key" $ export HW_SECRET_KEY="my-secret-key"
After setting the environment variables, declare the HUAWEI CLOUD provider.
provider "huaweicloud" {}
Parameter Description
Parameter |
Mandatory |
Environment Variable |
Description |
---|---|---|---|
region |
Yes |
HW_REGION_NAME |
Region where the HUAWEI CLOUD service is located. For details, see Regions and Endpoints. If you want to create cloud services in different regions, configure parameter alias or region for the resource corresponding to the cloud service. |
access_key |
Yes |
HW_ACCESS_KEY |
Access key ID of a user. For details on how to obtain an access key ID, see Access Keys. |
secret_key |
Yes |
HW_SECRET_KEY |
Secret access key of a user. For details on how to obtain a secret access key, see Access Keys. |
domain_name |
No |
HW_DOMAIN_NAME |
HUAWEI CLOUD account name. For details on how to obtain an account name, see API Credentials. |
project_name |
No |
HW_PROJECT_NAME |
HUAWEI CLOUD project name. For details on how to obtain a project name, see API Credentials. |
enterprise_project_id |
No |
HW_ENTERPRISE_PROJECT_ID |
Enterprise project ID. For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide. |
max_retries |
No |
HW_MAX_RETRIES |
Maximum number of retries allowed when a network transmission problem occurs. The default value is 5. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot