alicloud_snat_entry
更新时间:
Provides a snat resource.
-> NOTE: Available since v1.119.0.
Example Usage
Basic Usage
variable "name" {
default = "tf_example"
}
data "alicloud_zones" "default" {
available_resource_creation = "VSwitch"
}
resource "alicloud_vpc" "default" {
vpc_name = var.name
cidr_block = "172.16.0.0/12"
}
resource "alicloud_vswitch" "default" {
vpc_id = alicloud_vpc.default.id
cidr_block = "172.16.0.0/21"
zone_id = data.alicloud_zones.default.zones[0].id
vswitch_name = var.name
}
resource "alicloud_nat_gateway" "default" {
vpc_id = alicloud_vpc.default.id
nat_gateway_name = var.name
payment_type = "PayAsYouGo"
vswitch_id = alicloud_vswitch.default.id
nat_type = "Enhanced"
}
resource "alicloud_eip_address" "default" {
address_name = var.name
}
resource "alicloud_eip_association" "default" {
allocation_id = alicloud_eip_address.default.id
instance_id = alicloud_nat_gateway.default.id
}
resource "alicloud_snat_entry" "default" {
snat_table_id = alicloud_nat_gateway.default.snat_table_ids
source_vswitch_id = alicloud_vswitch.default.id
snat_ip = alicloud_eip_address.default.ip_address
}
Argument Reference
The following arguments are supported:
snat_table_id
- (Required, ForceNew) The value can get fromalicloud_nat_gateway
Attributes "snat_table_ids".source_vswitch_id
- (Optional, ForceNew) The vswitch ID.source_cidr
- (Optional, ForceNew, Available since v1.71.1) The private network segment of Ecs. This parameter and thesource_vswitch_id
parameter are mutually exclusive and cannot appear at the same time.snat_entry_name
- (Optional, Available since v1.71.2) The name of snat entry.snat_ip
- (Required, ForceNew) The SNAT ip address, the ip must along bandwidth package public ip whichalicloud_nat_gateway
argumentbandwidth_packages
.
Attributes Reference
The following attributes are exported:
id
- The ID of the snat entry. The value formats as<snat_table_id>:<snat_entry_id>
snat_entry_id
- The id of the snat entry on the server.status
- (Available since v1.119.1) The status of snat entry.
Timeouts
-> NOTE: Available since v1.119.0.
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 2 mins) Used when create the snat.update
- (Defaults to 2 mins) Used when update the snat.delete
- (Defaults to 2 mins) Used when delete the snat.
Import
Snat Entry can be imported using the id, e.g.
$ terraform import alicloud_snat_entry.foo stb-1aece3:snat-232ce2
文档内容是否对您有帮助?