在创建具备伸缩功能的节点池前,要为账号赋予相应权限,具体可参考通过Terraform创建具备自动伸缩功能的节点池。 对照文档中的入参列表Argument Reference,先编写出一个集群的描述,代码如下: 说明 当前示例代码支持一键运行,您可以直接运行代码。一键运行 provider "alicloud" { region = var.region } variable "region" ...
variable"credit_card"{type=map(string) description ="Credit Card Info"sensitive =truedefault= { number =123456789101112cvv =1314date ="15/16"postal_code ="18192"} } You would then reference the list and map variables the same way with thevar.variablesyntax. ...
_instance.default.id image_name = "terraform-example-${random_integer.default.result}" description = "terraform-example" } variable "another_uid" { default = "123456789" } resource "alicloud_image_share_permission" "default" { image_id = alicloud_image.default.id account_id = var.another_...
} We're using Terraform's interpolation feature (variable) in the "aws_instance" resource where another resource is being referenced. key_name = "${aws_key_pair.terraform-demo.key_name}" Note that we useresource_type.logical_name.attribute! We can run the tf file again via "terraform app...
Module Argument ReferenceSee variables.tf and examples/ for details and use-cases.Main Resource Configurationname: (Required string) The name of the repository. defaults: (Optional object(defaults)) DEPRECATED: This variable will be removed in future releases. It was needed in times when Terraform...
resource <AWS_Object> <User_Defined_Variable_Name_With_Underscore> {} e.g. resource "aws_instance" "instance" {} e.g. resource "aws_vpc" "my_vpc" {} e.g. resource "aws_subnet" "public" {} e.g. resource "aws_security_group" "allow_ssh" {} ...
Compile a cluster description by referring to the Argument Reference section in the preceding document. Sample code: Note You can run the sample code with a few clicks. provider "alicloud" { region = var.region } variable "region" { default = "cn-zhangjiakou" } # The default resource name...
variable "key_name" { type = string default = "einsteinish" } ./my_modules/instance/output.tf: output "instance_ip_addr" { value =aws_instance.my_instance.*.public_ipdescription = "The public IP address of the main instance."
variable "ami" { type = "map" default = { "us-east-1" = "ami-04169656fea786776" "us-west-1" = "ami-006fce2a9625b177f" } } variable "instance_count" { default = "1" } variable "instance_tags" { type = "list" default = ["Terraform-1", "Terraform-2"] } variable "instanc...
For clarity, the following Terraform code shows managing aresourceand using the previously defined Terraform Module Input Variable to set thenameattribute of the resource, along with another Input Variable to set theresource_group_nametoo. Plain text ...