# vim variables.tf# 阿里云子账户access_keyvariable "alicloud_access_key"{default="LTAI4GBXXXXXXXXXXXXXXXXXXXXXX"description="The Alicloud Access Key ID to launch resources. Support to environment 'ALICLOUD_ACCESS_KEY'."}# 阿里云子账户secret_keyvariable "alicloud_secret_key"{default="4Z4gbl3dXXXXXXXXXXXXXXXXXXXXX"description="The Alicloud Access Secret Key to launch resources. Support to environment 'ALICLOUD_SECRET_KEY'."}# 阿里云区域,这里为杭州地区variable "region"{default="cn-hangzhou"description="The Alicloud region resources. Support to environment 'REGION'."}# 设置阿里云杭州区域可用机房,这里设置为cn-hangzhou-ivariable "availability_zone"{description="The available zone to launch ecs instance and other resources."default="cn-hangzhou-i"}# 设置镜像版本variable "image_id"{default="ubuntu_18_04_64_20G_alibase_20190624.vhd"}# 设置ECS实例类型,对于variable "ecs_type"{default="ecs.s6-c1m2.small"}# 指定ECS实例密码variable "ecs_password"{default="Test12345"}# 指定ECS实例磁盘类型,这里为普通云盘variable "disk_category"{default="cloud_efficiency"}# 设置磁盘大小variable "disk_size"{default="40"}# 设置上网扣费泪行,默认为PayByTraffic(按流量计费)variable "internet_charge_type"{default="PayByTraffic"}# 公共网络最大传出带宽,从1.7版本,默认设置大于0会自动申请独享公网IP地址variable "internet_max_bandwidth_out"{default=5}
# terraform planAn execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# alicloud_instance.wanzi_test will be created + resource "alicloud_instance""wanzi_test"{ + availability_zone="cn-hangzhou-i" + credit_specification=(known after apply) + deletion_protection=false + dry_run=false + host_name=(known after apply) + id=(known after apply) + image_id="ubuntu_18_04_64_20G_alibase_20190624.vhd" + instance_charge_type="PostPaid" + instance_name="wanzi_tf001" + instance_type="ecs.s6-c1m2.small" + internet_max_bandwidth_in=(known after apply) + internet_max_bandwidth_out=0 + key_name=(known after apply) + password=(sensitive value) + private_ip=(known after apply) + public_ip=(known after apply) + role_name=(known after apply) + security_groups=(known after apply) + spot_strategy="NoSpot" + status="Running" + subnet_id=(known after apply) + system_disk_category="cloud_efficiency" + system_disk_performance_level=(known after apply) + system_disk_size=40 + volume_tags=(known after apply) + vswitch_id=(known after apply)}
# terraform applyAn execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# alicloud_instance.wanzi_test will be created + resource "alicloud_instance""wanzi_test"{ + availability_zone="cn-hangzhou-i" + credit_specification=(known after apply) + deletion_protection=false + dry_run=false + host_name=(known after apply) + id=(known after apply) + image_id="ubuntu_18_04_64_20G_alibase_20190624.vhd" + instance_charge_type="PostPaid" + instance_name="wanzi_tf001" + instance_type="ecs.s6-c1m2.small" + internet_max_bandwidth_in=(known after apply) + internet_max_bandwidth_out=0 + key_name=(known after apply) + password=(sensitive value) + private_ip=(known after apply) + public_ip=(known after apply) + role_name=(known after apply) + security_groups=(known after apply) + spot_strategy="NoSpot" + status="Running" + subnet_id=(known after apply) + system_disk_category="cloud_efficiency" + system_disk_performance_level=(known after apply) + system_disk_size=40 + volume_tags=(known after apply) + vswitch_id=(known after apply)}# alicloud_security_group.default will be created + resource "alicloud_security_group""default"{ + id=(known after apply) + inner_access=(known after apply) + inner_access_policy=(known after apply) + name="default" + security_group_type="normal" + vpc_id=(known after apply)}......
......
Plan: 5 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
alicloud_vpc.vpc: Creating...
alicloud_vpc.vpc: Creation complete after 9s [id=vpc-bp1kulcyygsi727aay4hd]alicloud_security_group.default: Creating...
alicloud_vswitch.vsw: Creating...
alicloud_security_group.default: Creation complete after 1s [id=sg-bp11s5pka9pxtj6pn4xq]alicloud_security_group_rule.allow_all_tcp: Creating...
alicloud_security_group_rule.allow_all_tcp: Creation complete after 1s [id=sg-bp11s5pka9pxtj6pn4xq:ingress:tcp:1/65535:intranet:0.0.0.0/0:accept:1]alicloud_vswitch.vsw: Creation complete after 4s [id=vsw-bp1wgpgz9z8y2lfsl2beo]alicloud_instance.wanzi_test: Creating...
alicloud_instance.wanzi_test: Still creating... [10s elapsed]alicloud_instance.wanzi_test: Still creating... [20s elapsed]alicloud_instance.wanzi_test: Creation complete after 22s [id=i-bp1gt9mb9asadff9r2zr]Apply complete! Resources: 5 added, 0 changed, 0 destroyed.