Byteplus Cloud Control Provider
The Byteplus Cloud Control Provider enables interaction with various Byteplus-supported resources through the Cloud Control API. Prior to usage, you must configure the provider with appropriate credentials.
Use the left navigation panel to explore available resource documentation. If you cannot find the desired resource, please submit an issue report for assistance.
NOTE:
- The Byteplus Cloud Control provider requires the use of Terraform 1.0.7 or later.
- This guide requires an available Byteplus account or sub-account to create resources.
Example Usage
Terraform 1.0.7 and later:
# Configure the Bytepluscc Provider
terraform {
required_providers {
bytepluscc = {
source = "byteplus-sdk/bytepluscc"
version = "~> 0.0.1"
}
}
}
# Create VPC
resource "bytepluscc_vpc_vpc" "VPCDemo" {
cidr_block = "192.168.0.0/24"
support_ipv_4_gateway = true
vpc_name = "vpc-demo"
description = "VpcDemo Example"
dns_servers = [
"12.3.x.x"
]
associate_cens = [
{
cen_id = "cen-3re8cx4vwdibk5zsk2xxxx"
cen_owner_id = "200000xxx"
cen_status = "Attaching"
}
]
nat_gateway_ids = [
"ngw-2d6tp1y8zq41s58ozfdxxx"
]
route_table_ids = [
"vtb-29mkf8ft83l6o1e1hgixxx"
]
security_group_ids = [
"sg-29mkx39jb80741e1hgj2bxxx"
]
project_name = "default"
tags = [
{
key = "env"
value = "test"
}
]
}
# Query VPC
data "bytepluscc_vpc_vpc" "VpcVpcDataSource" {
id = bytepluscc_vpc_vpc.VPCDemo.id
}
Authentication
The Bytepluscc provider offers a flexible means of providing credentials for authentication. The following methods are supported, in this order, and explained below:
Static credentials
Static credentials can be provided by adding an public_key and private_key in-line in the bytepluscc provider block:
Warning:
Hard-coded credentials are not recommended in any Terraform configuration and risks secret leakage should this file ever be committed to a public version control system.
Usage:
provider "bytepluscc" {
access_key = "your ak"
secret_key = "your sk"
region = "cn-beijing"
}
Environment variables
You can provide your credentials via BYTEPLUS_ACCESS_KEY and BYTEPLUS_SECRET_KEY environment variables, representing your byteplus public key and private key respectively. BYTEPLUS_REGION is also used, if applicable:
provider "bytepluscc" {
}
Usage:
$ export BYTEPLUS_ACCESS_KEY="your_public_key"
$ export BYTEPLUS_SECRET_KEY="your_private_key"
$ export BYTEPLUS_REGION="cn-beijing"
Schema
Optional
access_key (String) The Access Key for Byteplus Provider. It must be provided, but it can also be sourced from the BYTEPLUS_ACCESS_KEY environment variable
secret_key (String) he Secret Key for Byteplus Provider. It must be provided, but it can also be sourced from the BYTEPLUS_SECRET_KEY environment variable
assume_role (Attributes) An assume_role block (documented below). Only one assume_role block may be in the configuration. (see below for nested schema)
customer_headers (String) CUSTOMER HEADERS for Byteplus Provider. The customer_headers field uses commas (,) to separate multiple headers, and colons (:) to separate each header key from its corresponding value.
disable_ssl (Boolean) Disable SSL for Byteplus Provider
endpoints (Attributes) An endpoints block (documented below). Only one endpoints block may be in the configuration. (see below for nested schema)
proxy_url (String) PROXY URL for Byteplus Provider
region (String) The Region for Byteplus Provider. It must be provided, but it can also be sourced from the BYTEPLUS_REGION environment variable
Nested Schema for assume_role
Required:
assume_role_session_name (String) The session name to use when making the AssumeRole call.
assume_role_trn (String) he TRN of the role to assume.
duration_seconds (Number) The duration of the session when making the AssumeRole call. Its value ranges from 900 to 43200(seconds), and default is 3600 seconds.
Optional:
policy (String) A more restrictive policy when making the AssumeRole call
Nested Schema for endpoints
Optional:
cloudcontrolapi (String) Use this to override the default Cloud Control API service endpoint URL
sts (String) Use this to override the default STS service endpoint URL