arvancloud_vpc_nat_gateway (Resource)
Manages a VPC NAT Gateway that provides internet access for resources in a VPC subnet using an Elastic IP.
Example Usage
# Create a NAT gateway with an Elastic IP and subnet.
resource "arvancloud_vpc_nat_gateway" "example" {
name = "example-nat-gateway"
vpc_id = arvancloud_vpc.example.id
subnet_id = arvancloud_vpc_subnet.example.id
elastic_ip_id = arvancloud_vpc_elastic_ip.example.id
}
# Create multiple NAT gateways in different subnets.
resource "arvancloud_vpc_nat_gateway" "subnet_a" {
name = "nat-gateway-subnet-a"
vpc_id = arvancloud_vpc.app_vpc.id
subnet_id = arvancloud_vpc_subnet.subnet_a.id
elastic_ip_id = arvancloud_vpc_elastic_ip.eip_a.id
}
resource "arvancloud_vpc_nat_gateway" "subnet_b" {
name = "nat-gateway-subnet-b"
vpc_id = arvancloud_vpc.app_vpc.id
subnet_id = arvancloud_vpc_subnet.subnet_b.id
elastic_ip_id = arvancloud_vpc_elastic_ip.eip_b.id
}
# Output NAT gateway attributes.
output "example_natgw_id" {
value = arvancloud_vpc_nat_gateway.example.id
}
output "example_natgw_public_ip" {
value = arvancloud_vpc_nat_gateway.example.public_ip
}
output "example_natgw_state" {
value = arvancloud_vpc_nat_gateway.example.state
}
output "example_natgw_region" {
value = arvancloud_vpc_nat_gateway.example.region
}
Schema
Required
elastic_ip_id(String) ID of the Elastic IP to associate with the NAT gateway. Changing this value forces a new resource to be created.name(String) Name of the NAT gateway.subnet_id(String) ID of the subnet where the NAT gateway will be deployed. Changing this value forces a new resource to be created.vpc_id(String) ID of the VPC this NAT gateway belongs to. Changing this value forces a new resource to be created.
Read-Only
created_at(String) Timestamp when the NAT gateway was created.id(String) Unique identifier of the NAT gateway assigned by the API.public_ip(String) Public IP address of the NAT gateway (from the associated Elastic IP).region(String) Region where the NAT gateway is located.state(String) Current state of the NAT gateway (e.g., ACTIVE, PENDING, DELETING).
Import
Import is supported using the following syntax:
terraform import arvancloud_vpc_nat_gateway.example natgw-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx