### Get TencentCloud Instance Types Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index This example demonstrates how to use the `tencentcloud_instance_types` data source to find available instance types based on specified CPU core count and memory size. ```HCL # Get availability instance types data "tencentcloud_instance_types" "default" { cpu_core_count = 1 memory_size = 1 } ``` -------------------------------- ### Get TencentCloud Availability Zones Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index This example demonstrates how to use the `tencentcloud_availability_zones` data source to retrieve information about available availability zones within Tencent Cloud. ```HCL # Get availability zones data "tencentcloud_availability_zones" "default" {} ``` -------------------------------- ### Get TencentCloud Images Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index This snippet shows how to use the `tencentcloud_images` data source to fetch details about available public images, specifically filtering for CentOS operating systems. ```HCL # Get availability images data "tencentcloud_images" "default" { image_type = ["PUBLIC_IMAGE"] os_name = "centos" } ``` -------------------------------- ### Create TencentCloud Instance Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Defines a Tencent Cloud instance with specified configurations including name, availability zone, image, instance type, disk settings, public IP allocation, bandwidth, and security groups. It also includes a count for creating multiple instances. ```terraform resource "tencentcloud_instance" "web" { instance_name = "web server" availability_zone = data.tencentcloud_availability_zones.default.zones.0.name image_id = data.tencentcloud_images.default.images.0.image_id instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type system_disk_type = "CLOUD_PREMIUM" system_disk_size = 50 allocate_public_ip = true internet_max_bandwidth_out = 20 security_groups = [tencentcloud_security_group.default.id] count = 1 } ``` -------------------------------- ### Set TencentCloud Credentials via Environment Variables Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Sets the Tencent Cloud Secret ID, Secret Key, and Region using environment variables for authentication. These variables are then used by Terraform to authenticate with Tencent Cloud. ```bash $ export TENCENTCLOUD_SECRET_ID="my-secret-id" $ export TENCENTCLOUD_SECRET_KEY="my-secret-key" $ export TENCENTCLOUD_REGION="ap-guangzhou" $ terraform plan ``` -------------------------------- ### TencentCloud Provider Assume Role with SAML via Environment Variables Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Sets TencentCloud provider assume role with SAML configurations using environment variables. This allows for managing SAML-based role assumption without hardcoding sensitive assertion details. ```bash $ export TENCENTCLOUD_ASSUME_ROLE_ARN="my-role-arn" $ export TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME="my-session-name" $ export TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION=3600 $ export TENCENTCLOUD_ASSUME_ROLE_SAML_ASSERTION="my-saml-assertion" $ export TENCENTCLOUD_ASSUME_ROLE_PRINCIPAL_ARN="my-principal-arn" $ terraform plan ``` -------------------------------- ### TencentCloud Provider Assume Role via Environment Variables Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Sets TencentCloud provider assume role configurations using environment variables. This method allows for dynamic credential management without hardcoding values in the Terraform configuration. ```bash $ export TENCENTCLOUD_SECRET_ID="my-secret-id" $ export TENCENTCLOUD_SECRET_KEY="my-secret-key" $ export TENCENTCLOUD_REGION="ap-guangzhou" $ export TENCENTCLOUD_ASSUME_ROLE_ARN="my-role-arn" $ export TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME="my-session-name" $ export TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION=3600 $ export TENCENTCLOUD_ASSUME_ROLE_SERIAL_NUMBER="my-serial-number" $ export TENCENTCLOUD_ASSUME_ROLE_TOKEN_CODE="my-token-code" $ terraform plan ``` -------------------------------- ### TencentCloud Provider Assume Role with OIDC via Environment Variables Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Sets TencentCloud provider assume role with OIDC configurations using environment variables. This facilitates the use of OIDC tokens for role assumption in a flexible manner. ```bash $ export TENCENTCLOUD_SECRET_ID="my-secret-id" $ export TENCENTCLOUD_SECRET_KEY="my-secret-key" $ export TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION=3600 $ export TENCENTCLOUD_ASSUME_ROLE_WEB_IDENTITY_TOKEN="my-web-identity-token" $ export TENCENTCLOUD_ASSUME_ROLE_PROVIDER_ID="OIDC" $ terraform plan ``` -------------------------------- ### TencentCloud Provider Enable Pod OIDC Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Enables the TencentCloud provider to use TKE OIDC for pod identity. This requires successful creation of a CAM OIDC provider and the WEBHOOK component. ```Terraform provider "tencentcloud" { enable_pod_oidc = true } ``` -------------------------------- ### Assume Role with Web Identity Configuration Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Allows assuming an IAM role using web identity tokens (e.g., OIDC) for authentication with external identity providers. Requires the role ARN and supports environment variables. ```HCL assume_role_with_web_identity { role_arn = var.role_arn_web_identity # Other optional arguments like web_identity_token, session_name, etc. } ``` -------------------------------- ### Create TencentCloud Security Group Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Creates a Tencent Cloud security group with a specified name and description. This resource is used to define network access rules for instances. ```terraform resource "tencentcloud_security_group" "default" { name = "web accessibility" description = "make it accessible for both production and stage ports" } ``` -------------------------------- ### TencentCloud Provider Assume Role with OIDC Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to assume a role using OpenID Connect (OIDC) tokens. This method is useful for cloud-native environments and does not require AK/SK credentials. ```Terraform provider "tencentcloud" { assume_role_with_web_identity { provider_id = "OIDC" role_arn = "my-role-arn" session_name = "my-session-name" session_duration = 3600 web_identity_token = "my-web-identity-token" } } ``` -------------------------------- ### Assume Role with SAML Configuration Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures assuming an IAM role using SAML assertions for federated identity management. Requires the role ARN and supports environment variables for credentials. ```HCL assume_role_with_saml { role_arn = var.role_arn_saml # Other optional arguments like provider_url, attributes, etc. } ``` -------------------------------- ### TencentCloud Provider Assume Role with SAML Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to assume a role using SAML assertions. This method is suitable for environments that use SAML for identity federation and does not require AK/SK credentials. ```Terraform provider "tencentcloud" { assume_role_with_saml { role_arn = "my-role-arn" session_name = "my-session-name" session_duration = 3600 saml_assertion = "my-saml-assertion" principal_arn = "my-principal-arn" } } ``` -------------------------------- ### TencentCloud Provider Environment Variables Authentication Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to use environment variables for authentication. The Secret ID, Secret Key, and Region are read from `TENCENTCLOUD_SECRET_ID`, `TENCENTCLOUD_SECRET_KEY`, and `TENCENTCLOUD_REGION` respectively. ```terraform provider "tencentcloud" {} ``` -------------------------------- ### Configure TencentCloud Provider Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index This snippet shows how to configure the TencentCloud provider in Terraform, including specifying the source, version, and authentication credentials (secret_id, secret_key) along with the desired region. ```HCL terraform { required_providers { tencentcloud = { source = "tencentcloudstack/tencentcloud" } } } # Configure the TencentCloud Provider provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" } ``` -------------------------------- ### Assume Role Configuration Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Enables assuming an IAM role for enhanced security and access control. Supports specifying role ARN, session name, duration, and an optional policy for finer-grained permissions. ```HCL assume_role { role_arn = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME" session_name = "TerraformSession" session_duration = 3600 policy = "{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\", \"Action\": [\"sts:AssumeRole\"], \"Resource\": \"*\"}]}" } ``` -------------------------------- ### TencentCloud Provider Static Credentials with Allowed Accounts Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider with static credentials and specifies a list of allowed account IDs. This enhances security by restricting access to specific accounts. ```terraform provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" allowed_account_ids = ["100023201586", "100023201349"] } ``` -------------------------------- ### TencentCloud Provider Configuration Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider with essential authentication details and region. Supports environment variables for sensitive information like secret ID and key. ```HCL provider "tencentcloud" { secret_id = var.secret_id secret_key = var.secret_key region = var.region # Other optional arguments like security_token, shared_credentials_dir, profile, etc. } ``` -------------------------------- ### TencentCloud Provider with MFA Certification Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider for MFA authentication using secret_id, secret_key, and MFA details like serial_number, token_code, and duration_seconds. These can also be set via environment variables. ```HCL provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" mfa_certification { serial_number = "qcs::cam:uin/{my-uin}::mfa/softToken" token_code = "523886" duration_seconds = 1800 } } ``` ```bash $ export TENCENTCLOUD_MFA_CERTIFICATION_SERIAL_NUMBER="my-serial-number" $ export TENCENTCLOUD_MFA_CERTIFICATION_TOKEN_CODE="my-token-code" $ export TENCENTCLOUD_MFA_CERTIFICATION_DURATION_SECONDS=1800 $ terraform plan ``` -------------------------------- ### TencentCloud Provider Static Credentials Configuration Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider with static credentials, including secret ID, secret key, and region. This method is not recommended for production environments due to security risks. ```terraform provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" } ``` -------------------------------- ### TencentCloud Provider with Shared Credentials Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to use shared credentials files. Users can specify the directory for these files using `shared_credentials_dir` or the `TENCENTCLOUD_SHARED_CREDENTIALS_DIR` environment variable. It also supports profile configuration via `profile` or `TENCENTCLOUD_PROFILE`. ```HCL provider "tencentcloud" { shared_credentials_dir = "/Users/tf_user/.tccli" profile = "default" } ``` ```HCL provider "tencentcloud" { shared_credentials_dir = "C:\\Users\\tf_user\\.tccli" profile = "default" } ``` -------------------------------- ### TencentCloud Provider Assume Role Configuration Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to assume an IAM role using provided credentials and role details. This includes specifying the role ARN, session name, session duration, and optionally a policy or external ID. ```Terraform provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" assume_role { role_arn = "my-role-arn" session_name = "my-session-name" policy = "my-role-policy" session_duration = 3600 } } ``` -------------------------------- ### TencentCloud Provider Assume Role with MFA Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to assume an IAM role with Multi-Factor Authentication (MFA). This requires providing the role ARN, session name, session duration, and MFA serial number and token code. ```Terraform provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" assume_role { role_arn = "my-role-arn" session_name = "my-session-name" policy = "my-role-policy" session_duration = 3600 serial_number = "qcs::cam:uin/{my-uin}::mfa/softToken" token_code = "523886" } } ``` -------------------------------- ### TencentCloud Provider Static Credentials with Forbidden Accounts Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider with static credentials and specifies a list of forbidden account IDs. This prevents access from specific accounts. ```terraform provider "tencentcloud" { secret_id = "my-secret-id" secret_key = "my-secret-key" region = "ap-guangzhou" forbidden_account_ids = ["100023201223"] } ``` -------------------------------- ### Configure TencentCloud Security Group Rule for Web Access Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Adds an ingress rule to a Tencent Cloud security group to allow TCP traffic on ports 80 and 8080 from any IP address (0.0.0.0/0). This enables web server access. ```terraform resource "tencentcloud_security_group_rule" "web" { security_group_id = tencentcloud_security_group.default.id type = "ingress" cidr_ip = "0.0.0.0/0" ip_protocol = "tcp" port_range = "80,8080" policy = "accept" } ``` -------------------------------- ### TencentCloud Provider with CDC COS Domain Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to use a specific COS domain for CDC scenarios. The cos_domain can be set directly or via the TENCENTCLOUD_COS_DOMAIN environment variable. Requires region, secret_id, and secret_key. ```HCL locals { region = "ap-guangzhou" cdc_id = "cluster_xxx" } provider "tencentcloud" { region = local.region secret_id = "my-secret-id" secret_key = "my-secret-key" cos_domain = "https://${local.cdc_id}.cos-cdc.${local.region}.myqcloud.com/" } ``` ```bash $ export TENCENTCLOUD_SECRET_ID="my-secret-id" $ export TENCENTCLOUD_SECRET_KEY="my-secret-key" $ export TENCENTCLOUD_REGION="ap-guangzhou" $ export TENCENTCLOUD_COS_DOMAIN="https://cluster-xxxxxx.cos-cdc.ap-guangzhou.myqcloud.com/" $ terraform plan ``` -------------------------------- ### TencentCloud Provider with CAM Role Name Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Configures the TencentCloud provider to use a CAM role name for authentication. This method obtains STS credentials from a metadata URL and does not require secret_id or secret_key. It can also be combined with Assume Role authentication. ```HCL provider "tencentcloud" { cam_role_name = "my-cam-role-name" } ``` ```HCL provider "tencentcloud" { cam_role_name = "my-cam-role-name" assume_role { role_arn = "my-role-arn" session_name = "my-session-name" policy = "my-role-policy" session_duration = 3600 external_id = "my-external-id" } } ``` -------------------------------- ### Configure TencentCloud Security Group Rule for SSH Access Source: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/index Adds an ingress rule to a Tencent Cloud security group to allow TCP traffic on port 22 from any IP address (0.0.0.0/0). This enables SSH access to instances. ```terraform resource "tencentcloud_security_group_rule" "ssh" { security_group_id = tencentcloud_security_group.default.id type = "ingress" cidr_ip = "0.0.0.0/0" ip_protocol = "tcp" port_range = "22" policy = "accept" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.