File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
quickstarts/VPC/201-use-case-nat-gateway-snat-function Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ No modules.
45
45
| ------| -------------| ------| ---------| :--------:|
46
46
| <a name =" input_name " ></a > [ name] ( #input\_ name ) | n/a | ` string ` | ` "nat-test" ` | no |
47
47
| <a name =" input_password " ></a > [ password] ( #input\_ password ) | n/a | ` string ` | ` "Test123@" ` | no |
48
- | <a name =" input_region " ></a > [ region] ( #input\_ region ) | n/a | ` string ` | ` "cn-beijing " ` | no |
48
+ | <a name =" input_region " ></a > [ region] ( #input\_ region ) | n/a | ` string ` | ` "cn-shanghai " ` | no |
49
49
<!-- END_TF_DOCS -->
50
50
51
51
## Documentation
Original file line number Diff line number Diff line change 1
1
variable "region" {
2
- default = " cn-beijing "
2
+ default = " cn-shanghai "
3
3
}
4
4
provider "alicloud" {
5
5
region = var. region
@@ -21,9 +21,11 @@ data "alicloud_instance_types" "default" {
21
21
image_id = data. alicloud_images . default . images . 0 . id
22
22
}
23
23
# 可用区
24
- data "alicloud_zones" "default" {}
24
+ data "alicloud_zones" "default" {
25
+ available_resource_creation = " VSwitch"
26
+ available_disk_category = " cloud_efficiency"
27
+ }
25
28
locals {
26
- zone_id = " cn-beijing-h"
27
29
image_id = " aliyun_3_x64_20G_alibase_20241103.vhd"
28
30
}
29
31
# 创建VPC
@@ -35,7 +37,7 @@ resource "alicloud_vpc" "vpc" {
35
37
resource "alicloud_vswitch" "vsw" {
36
38
vpc_id = alicloud_vpc. vpc . id
37
39
cidr_block = " 192.168.20.0/24"
38
- zone_id = local . zone_id
40
+ zone_id = data . alicloud_zones . default . zones . 0 . id
39
41
vswitch_name = var. name
40
42
}
41
43
# 安全组
@@ -69,7 +71,7 @@ resource "alicloud_instance" "example" {
69
71
internet_max_bandwidth_out = " 0"
70
72
# 启动实例的可用区
71
73
// availability_zone = data.alicloud_instance_types.default.instance_types.0.availability_zones.0
72
- availability_zone = local . zone_id
74
+ availability_zone = data . alicloud_zones . default . zones . 0 . id
73
75
# 有效值为 PrePaid、PostPaid,默认值为 PostPaid。
74
76
instance_charge_type = " PostPaid"
75
77
# 仅对一些非 I/O 优化实例使用。
You can’t perform that action at this time.
0 commit comments