alicloud_snat_entries

This data source provides a list of Snat Entries owned by an Alibaba Cloud account.

Example Usage

variable "name" {
  default = "snat-entry-example-name"
}
data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}

resource "alicloud_vpc" "foo" {
  name       = "${var.name}"
  cidr_block = "172.16.0.0/12"
}

resource "alicloud_vswitch" "foo" {
  vpc_id            = "${alicloud_vpc.foo.id}"
  cidr_block        = "172.16.0.0/21"
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"
  vswitch_name      = var.name
}

resource "alicloud_nat_gateway" "foo" {
  vpc_id        = "${alicloud_vpc.foo.id}"
  specification = "Small"
  name          = "${var.name}"
}

resource "alicloud_eip_address" "foo" {
  address_name = "${var.name}"
}

resource "alicloud_eip_association" "foo" {
  allocation_id = "${alicloud_eip_address.foo.id}"
  instance_id   = "${alicloud_nat_gateway.foo.id}"
}

resource "alicloud_snat_entry" "foo" {
  snat_table_id     = "${alicloud_nat_gateway.foo.snat_table_ids}"
  source_vswitch_id = "${alicloud_vswitch.foo.id}"
  snat_ip           = "${alicloud_eip_address.foo.ip_address}"
}

data "alicloud_snat_entries" "foo" {
  snat_table_id = "${alicloud_snat_entry.foo.snat_table_id}"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported in addition to the arguments listed above: