- What's New
- Service Overview
- User Guide
- Template Reference
-
API Reference
- Before You Start
-
API
- Calling APIs
-
Stacks
- Listing Events of a Stack
- Obtaining Stack Metadata
- Listing Stacks
- Creating a Stack
- Obtaining a Stack Template
- Listing Stack Resources
- Listing Stack Outputs
- Continuing to Deploy a Stack
- Deploying a Stack
- Deleting a Stack
- Updating a Stack
- Deleting a Stack with Conditions
- Continuing to Roll Back a Stack
- Execution Plans
- Template Analysis
- Template Management
-
Stack Sets
- Listing Stack Sets
- Creating a Stack Set
- Obtaining a Stack Set Template
- Listing Stack Set Operations
- Obtaining Metadata of a Stack Set
- Listing Stack Instances
- Creating Stack Instances
- Deleting Stack Instance Deprecated
- Updating Stack Instances
- Deleting Stack Instances
- Deploying a Stack Set
- Deleting a Stack Set
- Updating a Stack Set
- Obtaining Metadata of a Stack Set Operation
- Obtaining a Stack Instance
- Customized Providers
- Resource Formation - Hook
- Resource Formation - Module Management
- Permissions and Supported Actions
- Appendix
- Change History
- FAQs
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
- Stack Management
- CTS
-
Template Reference
- Template Introduction
-
List of Elements
- Resource Indexes
- AOS.Stack
- CCE.Addon.AutoScaler
- CCE.Cluster
- CCE.HelmRelease
- CCE.NodePool
- CCE.Pod
- CCE.Storage.OBS
- CCE.Storage.SFS
- DCS.Redis
- ECS.CloudServer
- ECS.KeyPair
- NAT.Instance
- NAT.SNatRule
- OBS.Bucket
- RDS.MySQL
- SFS.FileSystem
- ULB.Healthmonitor
- ULB.Listener
- ULB.LoadBalancer
- ULB.Member
- ULB.Pool
- VPC.EIP
- VPC.SecurityGroup
- VPC.SecurityGroupRule
- VPC.Subnet
- VPC.VPC
-
Data Structure
- AOS.BatchItem
- Basic.KeyValuePair
- Basic.Label
- Basic.LabelSelector
- Basic.NameAndSecretValue
- Basic.NameKeyPair
- Basic.NameValuePair
- CCE.Addon.AutoScaler.Node
- CCE.DataVolume
- CCE.HelmChart
- CCE.Labels
- CCE.NodePool
- CCE.PublicIP
- DCS.InstanceBackupPolicy
- DCS.PeriodicalBackupPlan
- ECS.DataVolume
- ECS.EIP
- ECS.ExtendParam
- ECS.MountedVolumes
- ECS.NICS
- ECS.Personality
- ECS.PublicIP
- ECS.RootVolume
- ECS.SecurityGroup
- ECS.ServerTags
- ECS.VolumeExtendParam
- K8S.PodSecurityContext
- K8S.SecurityContext.SeLinuxOptions
- MySQL.DBUser
- MySQL.DataBase
- MySQL.DataStore
- RDS.BackupStrategy
- RDS.HA.Mysql
- RDS.Volume
- ULB.StickySession
- VPC.BandWidth
- VPC.PublicIP
- Appendix
- FAQs
- Change History
-
API Reference (ME-Abu Dhabi Region)
- Before You Start
- API Overview
- Calling APIs
-
API
- Creating a Template
- Querying a Template List
- Updating a Template
- Deleting a Template
- Downloading a Template
- Querying a Template
- Querying the Input Parameters of a Template
- Creating a Stack
- Deleting a Stack
- Executing a Stack Lifecycle
- Querying a Stack List
- Querying a Stack
- Querying a Stack Element List
- Querying a Stack Element
- Querying a Stack Output
- Querying Stack Input
- Querying the Execution Record of a Stack
- Querying a Stack Execution Record List
- Appendix
- Change History
-
API Reference (Kuala Lumpur Region)
- Before You Start
-
API
- Calling APIs
-
Stacks
- Listing Events of a Stack
- Obtaining Stack Metadata
- Listing Stacks
- Creating a Stack
- Obtaining a Stack Template
- Listing Stack Resources
- Listing Stack Outputs
- Continuing to Deploy a Stack
- Deploying a Stack
- Deleting a Stack
- Updating a Stack
- Deleting a Stack with Conditions
- Continuing to Roll Back a Stack
- Execution Plans
- Template Analysis
- Template Management
-
Stack Sets
- Listing Stack Sets
- Creating a Stack Set
- Obtaining a Stack Set Template
- Listing Stack Set Operations
- Obtaining Metadata of a Stack Set
- Listing Stack Instances
- Creating Stack Instances
- Deleting Stack Instance Deprecated
- Updating Stack Instances
- Deploying a Stack Set
- Deleting Stack Instances
- Deleting a Stack Set
- Updating a Stack Set
- Obtaining Metadata of a Stack Set Operation
- Obtaining a Stack Instance
- Appendix
- Change History
- User Guide (Kuala Lumpur Region)
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Copied.
Basic Syntax
The RFS configuration language is easy, highly readable, and compatible with the HCL and JSON syntax. This section describes the basic syntax and common functions of the HCL.
The RFS configuration language consists of arguments, blocks, expressions, and functions.
Arguments
Use an equal sign (=) to assign a value or expression to a particular name, which can contain letters, digits, underscores (_), and hyphens (-), but cannot start with a digit. For example:
image_id = "ad091b52-742f-469e-8f3c-fd81cadf0743"
Blocks
resource "myinstance" { name = "myinstance" ...... network { uuid = "55534eaa-533a-419d-9b40-ec427ea7195a" } }
Before using a block, you must declare its type (resource and network in this example), where resource is the top-level block type and network is the nested block type. The top-level block type keywords supported by the HCL include provider, resource, data, variable, output, module, and locals.
Block labels are defined after the block type, and the number of block labels is determined by the block type. In the example, the resource block type expects : myinstance. The nested network type does not have block labels. The block body is defined at the last and delimited by the { and } characters. Other types can be nested in the block body to implement different layered structures.
Argument Types
The HCL supports the following argument types:
Basic types
- string: consists of one or more Unicode characters, for example, hello.
- number: can be an integer or a floating point number.
- bool: can only be true or false.
The HCL can automatically convert the number and bool types to the string type based on the argument type. If a string can be represented as a value of the number or bool type, it can also be converted to the other two types. Arguments of the three types can be directly assigned values. For example:
disk_type = "SSD" disk_size = 40 enable = true # Strings can be of the number and bool types. disk_size = "40" enable = "true"
Set types
- map(...): a set of data elements combined using key-value pairs. The key is of the string type, while the value can be of the string, number, or bool type. The values of all elements must be of the same type.
- list(...): a set of data elements of the same type. The elements can be of the basic type or block type. The list index starts from 0.
- set(...): similar to the list type. Elements in a set are unique and do not have any auxiliary identifier or sequence.
# Recommended format tags = { foo = "bar" key = "value" } # Other formats tags = {"foo" = "bar", "key" = "value"} tags = {"foo" : "bar", "key" : "value"} tags = {foo = "bar", key = "value"} tags = {foo : "bar", key : "value"} tags = { foo : "bar" key : "value" }
The list type and set type are represented in the same way. The list/set whose elements are of the basic type is delimited using [ and ], and the list/set whose elements are of the block type is represented in the form of repeated blocks. For example:
# List whose elements are of the basic type security_groups = ["default", "internal"] # List whose elements are of the block type network { uuid = "55534eaa-533a-419d-9b40-ec427ea7195a" } network { uuid = "ad091b52-742f-469e-8f3c-fd81cadf0743" }
Special types
- null: If a parameter is set to null, the parameter has no specified value. The HCL automatically ignores the parameter and uses the default value. Null is common in conditional expressions, for example, var.test==""? null: var.test, indicating that when the value of var.test is "", it is ignored.
Other Syntax
- A single-line comment starts with # or //.
- /* and */ are start and end delimiters for a comment that might span over multiple lines. Nested block comments are not supported.
- Terraform configuration files are UTF-8 encoded. Terraform accepts non-ASCII characters in identifiers, comments, and string values.
- A multi-line string starts with <<EOF, contains the string content in the middle, and ends with EOF. EOF can also be replaced with other characters. For example:
... website { ... routing_rules = <<EOF [{ "Condition": { "KeyPrefixEquals": "docs/" }, "Redirect": { "ReplaceKeyPrefixWith": "documents/" } }] EOF } }
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