### Install copystructure
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/mitchellh/copystructure/README.md
Use standard `go get` to install the library.
```bash
go get github.com/mitchellh/copystructure
```
--------------------------------
### Start Server
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/workspace_app_server_batch_action.md
This example demonstrates how to use the `huaweicloud_workspace_app_server_batch_action` resource to start multiple APP servers.
```APIDOC
## POST /api/workspace/app_servers/batch_action
### Description
Performs a batch operation on APP servers, such as starting them.
### Method
POST
### Endpoint
/api/workspace/app_servers/batch_action
### Parameters
#### Request Body
- **type** (string) - Required - Specifies the batch operation type. For starting, use `batch-start`.
- **content** (string) - Required - A JSON string containing the operation details.
- **items** (array of strings) - Required - List of server IDs to operate on.
### Request Example
```json
{
"type": "batch-start",
"content": {
"items": ["server-id-1", "server-id-2"]
}
}
```
### Response
#### Success Response (200)
- **status** (string) - The status of the batch operation.
- **task_id** (string) - The ID of the task created for the batch operation.
#### Response Example
```json
{
"status": "processing",
"task_id": "task-abc123"
}
```
```
--------------------------------
### Install the color package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/fatih/color/README.md
Use the go get command to install the package.
```bash
go get github.com/fatih/color
```
--------------------------------
### Install go-isatty Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/mattn/go-isatty/README.md
Run this command to install the go-isatty package using go get.
```bash
go get github.com/mattn/go-isatty
```
--------------------------------
### Install Golangsdk
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/chnsz/golangsdk/CONTRIBUTING.md
Download the repository using the go get command.
```bash
go get github.com/chnsz/golangsdk
```
--------------------------------
### Install go-version library
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/hashicorp/go-version/README.md
Use the standard go get command to add the library to your project.
```bash
$ go get github.com/hashicorp/go-version
```
--------------------------------
### Install go-ini/ini Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/gopkg.in/ini.v1/README.md
Use 'go get' to install the INI package. Add the '-u' flag for future updates.
```sh
go get gopkg.in/ini.v1
```
--------------------------------
### Start CDM Cluster
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/cdm_cluster_action.md
This example illustrates how to start a CDM cluster.
```APIDOC
## POST /huaweicloud/cdm/cluster/action
### Description
Manages a CDM cluster action resource within HuaweiCloud, specifically for starting the cluster.
### Method
POST
### Endpoint
/huaweicloud/cdm/cluster/action
### Parameters
#### Request Body
- **cluster_id** (String) - Required - ID of CDM cluster.
- **type** (String) - Required - Action type. Must be "start".
### Request Example
```json
{
"cluster_id": "your_cluster_id",
"type": "start"
}
```
### Response
#### Success Response (200)
- **id** (String) - The resource ID.
#### Response Example
```json
{
"id": "cluster_action_id"
}
```
```
--------------------------------
### Install Match Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/tidwall/match/README.md
Install the tidwall/match package using the go get command.
```bash
go get -u github.com/tidwall/match
```
--------------------------------
### Install GoJSONQ Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/thedevsaddam/gojsonq/README.md
Install the GoJSONQ package using the go get command. Choose the appropriate import path for your project.
```bash
$ go get github.com/thedevsaddam/gojsonq
// or
$ go get gopkg.in/thedevsaddam/gojsonq.v2
```
--------------------------------
### Install tagparser library
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/vmihailenco/tagparser/README.md
Use the go get command to add the package to your project.
```shell
go get -u github.com/vmihailenco/tagparser
```
--------------------------------
### Install msgpack Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/vmihailenco/msgpack/README.md
Use 'go get' to install the msgpack package. This command fetches and installs the latest version.
```shell
go get -u github.com/vmihailenco/msgpack
```
--------------------------------
### Install json-iterator/go
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/json-iterator/go/README.md
Use the go get command to install the json-iterator/go library.
```go
go get github.com/json-iterator/go
```
--------------------------------
### Install go-colorable Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/mattn/go-colorable/README.md
Install the go-colorable package using the go get command. This is a prerequisite for using the package in your Go projects.
```bash
$ go get github.com/mattn/go-colorable
```
--------------------------------
### Install crypt library
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/GehirnInc/crypt/README.rst
Use the go get command to download and install the crypt package.
```sh
go get github.com/GehirnInc/crypt
```
--------------------------------
### Batch auto install applications with assigned users
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/workspace_application_batch_auto_install.md
This example demonstrates how to batch auto-install applications for a specific list of users. The `assign_scope` must be 'ASSIGN_USER', and the `users` block should be dynamically populated with user accounts. Applications must support silent or unzip installation.
```hcl
variable "application_ids" {
type = list(string)
}
variable "user_names" {
type = list(string)
}
resource "huaweicloud_workspace_application_batch_auto_install" "test" {
app_ids = var.application_ids
assign_scope = "ASSIGN_USER"
dynamic "users" {
for_each = var.user_names
content {
account = users.value
account_type = "SIMPLE"
}
}
}
```
--------------------------------
### Install GJSON library
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/tidwall/gjson/README.md
Use the go get command to retrieve the GJSON package.
```sh
$ go get -u github.com/tidwall/gjson
```
--------------------------------
### ModelArts DevServer Action Example
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/modelarts_devserver_action.md
This example demonstrates how to start a ModelArts DevServer using its ID and specifying the 'start' action. Ensure the `devserver_id` variable is defined.
```hcl
variable "devserver_id" {}
resource "huaweicloud_modelarts_devserver_action" "test" {
devserver_id = var.devserver_id
action = "start"
}
```
--------------------------------
### Install uuid Package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/google/uuid/README.md
Use 'go get' to install the uuid package. This command fetches and installs the package and its dependencies.
```sh
go get github.com/google/uuid
```
--------------------------------
### Install Pretty package
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/tidwall/pretty/README.md
Use this command to retrieve the library via Go modules.
```sh
$ go get -u github.com/tidwall/pretty
```
--------------------------------
### Install MessagePack for Go
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/vmihailenco/msgpack/v4/README.md
Commands to initialize a Go module and fetch the MessagePack package.
```shell
go mod init github.com/my/repo
go get github.com/vmihailenco/msgpack/v4
```
--------------------------------
### Reinstall Server
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/workspace_app_server_action.md
This example demonstrates how to reinstall an existing APP server.
```APIDOC
## POST /api/workspace/app_server/actions
### Description
This endpoint allows you to perform actions on an APP server, such as changing its image or reinstalling it.
### Method
POST
### Endpoint
/api/workspace/app_server/actions
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **type** (string) - Required - Specifies the operation (action) type for the APP server. Valid values: "change-image", "reinstall".
- **server_id** (string) - Required - Specifies the ID of the server to be operated.
- **content** (string) - Required - Specifies the JSON string content for the operation (action) request.
- For "change-image":
- **image_id** (string) - Required - The ID of the new image.
- **image_type** (string) - Required - The type of the new image.
- **os_type** (string) - Required - The operating system type of the image.
- **image_product_id** (string) - Required - The product ID of the image.
- **update_access_agent** (boolean) - Optional - Whether to update the access agent.
- For "reinstall":
- **update_access_agent** (boolean) - Optional - Whether to update the access agent.
- **max_retries** (integer) - Optional - Specifies the maximum number of retries for the operation when encountering 409 conflict errors. Defaults to 0.
### Request Example
```json
{
"type": "reinstall",
"server_id": "server-uuid",
"content": "{\"update_access_agent\": false}"
}
```
### Response
#### Success Response (200)
- **id** (string) - The ID of the operation request.
#### Response Example
```json
{
"id": "operation-request-uuid"
}
```
```
--------------------------------
### Create a GeminiDB Instance
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/geminidb_instance.md
This example demonstrates how to create a GeminiDB instance with specified configurations for datastore, flavor, and backup strategy. Ensure all required variables like VPC, subnet, and security group IDs are defined.
```hcl
variable "vpc_id" {}
variable "subnet_id" {}
variable "security_group_id" {}
variable "availability_zone" {}
variable "configuration_id" {}
variable "enterprise_project_id" {}
resource "huaweicloud_geminidb_instance" "test" {
name = "test_name"
availability_zone = var.availability_zone
vpc_id = var.vpc_id
subnet_id = var.subnet_id
security_group_id = var.security_group_id
password = "test_password"
mode = "Cluster"
configuration_id = var.configuration_id
enterprise_project_id = var.enterprise_project_id
port = 8888
ssl_option = "on"
datastore {
type = "redis"
version = "5.0"
storage_engine = "rocksDB"
}
flavor {
num = "5"
size = "16"
storage = "ULTRAHIGH"
spec_code = "geminidb.redis.large.2"
}
backup_strategy {
start_time = "03:00-04:00"
keep_days = 14
}
tags = {
foo = "bar"
key = "value"
}
}
```
--------------------------------
### Example Usage
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/lts_struct_template.md
Examples demonstrating how to create a log structuring template with system or custom templates.
```APIDOC
## Example Usage
### create with system template
```hcl
variable "group_id" {}
variable "stream_id" {}
resource "huaweicloud_lts_struct_template" "test" {
log_group_id = var.group_id
log_stream_id = var.stream_id
template_type = "built_in"
template_name = "ELB"
}
```
### create with custom template
```hcl
variable "group_id" {}
variable "stream_id" {}
resource "huaweicloud_lts_struct_template" "test" {
log_group_id = var.group_id
log_stream_id = var.stream_id
template_type = "custom"
}
```
```
--------------------------------
### Install mapstructure via go get
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/mitchellh/mapstructure/README.md
Use this command to download and install the library into your Go workspace.
```bash
$ go get github.com/mitchellh/mapstructure
```
--------------------------------
### Terraform tfvars Example
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/examples/lts/log-transfer/README.md
Example of a terraform.tfvars file to configure required variables for the log transfer setup.
```hcl
group_name = "tf_test_log_group"
stream_name = "tf_test_log_stream"
bucket_name = "tf-test-log-transfer-obs-bucket"
```
--------------------------------
### Query All AccessKeys
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/identity_access_key.md
This example demonstrates how to query all available access keys.
```APIDOC
## Query AccessKey
### Description
Queries all available access keys within the account.
### Method
GET (Implicit for data source)
### Endpoint
N/A (Data Source)
### Parameters
This data source does not accept any parameters when querying all access keys.
### Request Example
```hcl
data "huaweicloud_identity_access_key" "test3" {}
```
### Response
#### Success Response (200)
- **id** (String) - The data source ID.
- **credentials** (Object) - The credentials carrying user information.
- **user_id** (String) - Indicates the IAM user ID to which the access_key belongs.
- **access** (String) - Indicates the Access Key (AK) that was queried.
- **status** (String) - Indicates the status of the access_key. Valid values: active, inactive.
- **create_time** (String) - Indicates the creation time of the access_key.
- **description** (String) - Indicates the description of the access_key.
- **last_use_time** (String) - Indicates the field is only present when you are certified by access_key.
#### Response Example
(Example not provided in source)
```
--------------------------------
### Scenario: Create Group and Users with Project-Level Authorization
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/examples/iam/users-authorized-through-group/README.md
Example configuration for setting up a new group and user with project-level permissions.
```hcl
role_name = "system_all_3" # ECS FullAccess
group_name = "tf_test_group"
authorized_project_name = "cn-north-4"
users_configuration = [
{
name = "tf_test_user"
}
]
```
--------------------------------
### Create a Kafka instance using flavor ID
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/dms_kafka_instance.md
Demonstrates how to provision a Kafka instance by querying available flavors and configuring network, storage, and security parameters.
```hcl
variable "vpc_id" {}
variable "subnet_id" {}
variable "security_group_id" {}
variable "access_password" {}
variable "availability_zones" {
default = ["your_availability_zones_a", "your_availability_zones_b", "your_availability_zones_c"]
}
variable "flavor_id" {
default = "your_flavor_id, such: c6.2u4g.cluster"
}
variable "storage_spec_code" {
default = "your_storage_spec_code, such: dms.physical.storage.ultra.v2"
}
# Query flavor information based on flavorID and storage I/O specification.
# Make sure the flavors are available in the availability zone.
data "huaweicloud_dms_kafka_flavors" "test" {
type = "cluster"
flavor_id = var.flavor_id
availability_zones = var.availability_zones
storage_spec_code = var.storage_spec_code
}
resource "huaweicloud_dms_kafka_instance" "test" {
name = "kafka_test"
vpc_id = var.vpc_id
network_id = var.subnet_id
security_group_id = var.security_group_id
flavor_id = data.huaweicloud_dms_kafka_flavors.test.flavor_id
storage_spec_code = data.huaweicloud_dms_kafka_flavors.test.flavors[0].ios[0].storage_spec_code
availability_zones = var.availability_zones
engine_version = "2.7"
storage_space = 600
broker_num = 3
ssl_enable = true
access_user = "user"
password = var.access_password
parameters {
name = "min.insync.replicas"
value = "2"
}
}
```
--------------------------------
### Use the global logger
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/hashicorp/go-hclog/README.md
Logs a simple "hello world" message using the default global logger instance. Output includes timestamp, log level, and message.
```go
hclog.Default().Info("hello world")
```
--------------------------------
### Get SecMaster Installation Scripts
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/secmaster_installation_scripts.md
Use this data source to retrieve installation scripts for SecMaster nodes. It requires the `workspace_id` as a parameter.
```hcl
variable "workspace_id" {}
data "huaweicloud_secmaster_installation_scripts" "test" {
workspace_id = var.workspace_id
}
```
--------------------------------
### Query all plugins under specified instance
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/apig_plugins.md
This example demonstrates how to fetch all plugins associated with a specific API Gateway instance by providing only the instance ID.
```APIDOC
## GET /apigw/{instance_id}/plugins
### Description
Retrieves a list of all plugins under the specified dedicated API Gateway instance.
### Method
GET
### Endpoint
/apigw/{instance_id}/plugins
### Parameters
#### Path Parameters
- **instance_id** (String) - Required - The ID of the dedicated instance to which the plugin belongs.
#### Query Parameters
- **region** (String) - Optional - Specifies the region in which to query the resource. If omitted, the provider-level region will be used.
### Response
#### Success Response (200)
- **id** (String) - The data source ID.
- **plugins** (Array) - A list of plugins matching the filter parameters. Each plugin object contains:
- **id** (String) - The ID of the plugin.
- **name** (String) - The name of the plugin.
- **type** (String) - The type of the plugin.
- **content** (String) - The content of the plugin.
- **plugin_scope** (String) - The scope of the plugin.
- **description** (String) - The description of the plugin.
- **created_at** (String) - The creation time of the plugin, in RFC3339 format.
- **updated_at** (String) - The latest update time of the plugin, in RFC3339 format.
### Request Example
```hcl
variable "instance_id" {}
data "huaweicloud_apig_plugins" "test" {
instance_id = var.instance_id
}
```
### Response Example
```json
{
"id": "some_id",
"plugins": [
{
"id": "plugin_id_1",
"name": "plugin_name_1",
"type": "cors",
"content": "{\"allow_origin\": \"*\"}",
"plugin_scope": "global",
"description": "CORS plugin",
"created_at": "2023-10-27T10:00:00Z",
"updated_at": "2023-10-27T10:00:00Z"
}
]
}
```
```
--------------------------------
### GET /hss/setting/docker-plugin-install-script
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/hss_setting_docker_plugin_install_script.md
Retrieves the installation script for a specified Docker plugin.
```APIDOC
## GET /hss/setting/docker-plugin-install-script
### Description
Retrieves the Docker plugin installation script based on the provided plugin type and operation type.
### Parameters
#### Query Parameters
- **region** (String) - Optional - Specifies the region in which to query the resource.
- **plugin** (String) - Required - Specifies the plug-in type. Valid value: opa-docker-authz.
- **operate_type** (String) - Required - Specifies the operation type. Valid values: install, upgrade, uninstall.
- **outside_host** (Bool) - Optional - Specifies whether a server is a non-Huawei Cloud server. Default: false.
- **batch_install** (Bool) - Optional - Specifies whether to install in batches. Default: true.
- **enterprise_project_id** (String) - Optional - Specifies the enterprise project ID. Default: 0.
### Response
#### Success Response (200)
- **id** (String) - The data source ID.
- **data_list** (List) - The docker plug-in script information containing:
- **package_type** (String) - The installation package type.
- **cmd** (String) - The command cmd.
- **package_download_url** (String) - The package download address.
```
--------------------------------
### Querying Applications
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/apig_applications.md
This example demonstrates how to query for applications using their instance ID and name.
```APIDOC
## Data Source: huaweicloud_apig_applications
Use this data source to query the applications within HuaweiCloud.
### Example Usage
```hcl
variable "instance_id" {}
variable "application_name" {}
data "huaweicloud_apig_applications" "test" {
instance_id = var.instance_id
name = var.application_name
}
```
## Argument Reference
The following arguments are supported:
* `region` - (Optional, String) Specifies the region where the applications are located.
If omitted, the provider-level region will be used.
* `instance_id` - (Required, String) Specifies the ID of the dedicated instance to which the applications belong.
* `application_id` - (Optional, String) Specifies the ID of the application to be queried.
* `name` - (Optional, String) Specifies the name of the application to be queried.
* `app_key` - (Optional, String) Specifies the key of the application to be queried.
## Attribute Reference
In addition to all arguments above, the following attributes are exported:
* `id` - The data source ID.
* `applications` - The list of the applications that matched filter parameters.
The [applications](#attrblock_applications_attr) structure is documented below.
The `applications` block supports:
* `id` - The ID of the application.
* `name` - The name of the application.
* `status` - The status of the application.
* `description` - The description of the application.
* `app_key` - The key of the application.
* `app_secret` - The secret of the application.
* `app_type` - The type of the application.
* `bind_num` - The number of bound APIs.
* `created_by` - The creator of the application.
* `created_at` - The creation time of the application, in RFC3339 format.
* `updated_at` - The latest update time of the application, in RFC3339 format.
```
--------------------------------
### Get a list of KMS keys
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/kms_keys.md
Use this data source to get a list of keys. No specific setup or imports are required beyond the standard Terraform configuration.
```hcl
data "huaweicloud_kms_keys" "test" {}
```
--------------------------------
### Get CPH Servers
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/cph_servers.md
Use this data source to get servers of CPH phone. No specific setup or imports are required beyond the standard Terraform configuration.
```hcl
data "huaweicloud_cph_servers" "test" {}
```
--------------------------------
### AS Configuration With User Data and Metadata
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/as_configuration.md
Includes custom user data script and metadata for an AS instance. User data is executed on instance startup, and metadata can store custom key-value pairs.
```hcl
variable "flavor_id" {}
variable "image_id" {}
variable "ssh_key" {}
variable "security_group_id" {}
resource "huaweicloud_as_configuration" "my_as_config" {
scaling_configuration_name = "my_as_config"
instance_config {
flavor = var.flavor_id
image = var.image_id
key_name = var.ssh_key
security_group_ids = [var.security_group_id]
user_data = file("userdata.txt")
disk {
size = 40
volume_type = "SSD"
disk_type = "SYS"
}
metadata = {
some_key = "some_value"
}
}
}
```
--------------------------------
### Get Docker Plugin Install Script
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/hss_setting_docker_plugin_install_script.md
Use this data source to retrieve the installation script for a specified Docker plugin. Configure the `plugin` and `operate_type` arguments to specify which plugin and operation (install, upgrade, uninstall) you need.
```hcl
variable "operate_type" {}
data "huaweicloud_hss_setting_docker_plugin_install_script" "test" {
plugin = "opa-docker-authz"
operate_type = var.operate_type
}
```
--------------------------------
### Basic Example Usage
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/secmaster_playbook.md
Demonstrates a basic configuration for creating a SecMaster playbook resource.
```APIDOC
### Basic Example
```hcl
variable "workspace_id" {}
variable "name" {}
resource "huaweicloud_secmaster_playbook" "test" {
workspace_id = var.workspace_id
name = var.name
description = "created by terraform"
}
```
```
--------------------------------
### Get HSS Baseline Overviews
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/hss_baseline_overviews.md
Use this data source to get the overviews of baseline check. No specific setup or constraints are mentioned beyond standard provider configuration.
```hcl
data "huaweicloud_hss_baseline_overviews" "test" {}
```
--------------------------------
### Enable datastore key conversion for basic or manual scaling
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/google.golang.org/appengine/README.md
Call this in the /_ah/start handler to enable key conversion for all service handlers.
```go
http.HandleFunc("/_ah/start", func(w http.ResponseWriter, r *http.Request) {
datastore.EnableKeyConversion(appengine.NewContext(r))
})
```
--------------------------------
### Get GaussDB OpenGauss Tasks
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/gaussdb_tasks.md
Use this data source to get the list of GaussDB OpenGauss tasks. No specific setup is required beyond the standard Terraform configuration.
```hcl
data "huaweicloud_gaussdb_tasks" "test" {}
```
--------------------------------
### Install and build multiple versions
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/github.com/hashicorp/hc-install/README.md
Iterates through a list of versions matching a constraint and includes a build from a Git revision for testing purposes.
```go
i := NewInstaller()
vc, _ := version.NewConstraint(">= 0.12")
rv := &releases.Versions{
Product: product.Terraform,
Constraints: vc,
}
versions, err := rv.List(context.Background())
if err != nil {
return err
}
versions = append(versions, &build.GitRevision{Ref: "HEAD"})
for _, installableVersion := range versions {
execPath, err := i.Ensure(context.Background(), []src.Source{
installableVersion,
})
if err != nil {
return err
}
// Do some testing here
_ = execPath
// clean up
os.Remove(execPath)
}
```
--------------------------------
### Get RMS Policy States Summary
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/rms_policy_states_summary.md
Use this data source to get compliance summary by user. No specific setup or imports are required beyond standard Terraform configuration.
```hcl
data "huaweicloud_rms_policy_states_summary" "test" {}
```
--------------------------------
### Basic Usage of Application Catalogs Data Source
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/workspace_application_catalogs.md
This example shows the basic configuration to query application catalogs. Ensure the region is correctly set in your provider configuration or explicitly passed as an argument if needed.
```hcl
data "huaweicloud_workspace_application_catalogs" "test" {}
```
--------------------------------
### Get AOM Dashboards Folders
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/aom_dashboards_folders.md
Use this data source to get the list of AOM dashboards folders. No specific setup or imports are required beyond the standard Terraform configuration.
```hcl
data "huaweicloud_aom_dashboards_folders" "test" {}
```
--------------------------------
### Basic Usage
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/geminidb_flavors.md
This example demonstrates the basic usage of the `huaweicloud_geminidb_flavors` data source to retrieve all available GeminiDB instance flavors.
```APIDOC
## Basic Usage
```hcl
data "huaweicloud_geminidb_flavors" "test" {}
```
```
--------------------------------
### Get List of Dedicated Host Instances
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/data-sources/deh_instances.md
Use this data source to get the list of dedicated host instances. No specific setup or imports are required beyond the standard Terraform configuration.
```hcl
data "huaweicloud_deh_instances" "test" {}
```
--------------------------------
### Create System Image from OBS Bucket
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/images_image.md
This example demonstrates creating a system image from an OBS bucket. You need to specify the image URL, minimum disk size, and a name for the image.
```hcl
variable "name" {}
variable "image_url" {}
variable "min_disk" {}
resource "huaweicloud_images_image" "test" {
name = var.name
image_url = var.image_url
min_disk = var.min_disk
}
```
--------------------------------
### Install YAML package for Go
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/vendor/gopkg.in/yaml.v3/README.md
Use the go get command to add the package to your project.
```bash
go get gopkg.in/yaml.v3
```
--------------------------------
### Create OBS Bucket Policy (S3 Format)
Source: https://github.com/huaweicloud/terraform-provider-huaweicloud/blob/master/docs/resources/obs_bucket_policy.md
This example demonstrates attaching a bucket policy using the S3 compatible format. Specify `policy_format = "s3"` and ensure the policy adheres to S3 syntax, including versioning and ARNs.
```hcl
resource "huaweicloud_obs_bucket" "bucket" {
bucket = "my-test-bucket"
}
resource "huaweicloud_obs_bucket_policy" "s3_policy" {
bucket = huaweicloud_obs_bucket.bucket.id
policy_format = "s3"
policy = <