پرش به مطلب اصلی

arvancloud_vpc (Resource)

Manages a Virtual Private Cloud (VPC) in a specific region.

Example Usage

# Create a VPC with required fields.
resource "arvancloud_vpc" "example" {
name = "my-vpc"
cidr_block = "10.0.0.0/16"
region = "ir-central1"
}

# Create a VPC with a different CIDR block.
resource "arvancloud_vpc" "app_vpc" {
name = "app-vpc"
cidr_block = "172.16.0.0/20"
region = "ir-central1"
}

output "example_vpc_id" {
value = arvancloud_vpc.example.id
}

output "example_vpc_state" {
value = arvancloud_vpc.example.state
}

output "example_vpc_created_at" {
value = arvancloud_vpc.example.created_at
}

output "app_vpc_subnets" {
value = arvancloud_vpc.app_vpc.subnets
}

Schema

Required

  • cidr_block (String) CIDR block for the VPC (e.g., 10.0.0.0/16). Must be between /16 and /28 in a private IPv4 range. Changing this value forces a new resource to be created.
  • name (String) Name of the VPC.
  • region (String) Region where the VPC will be created (e.g., ir-central1). Changing this value forces a new resource to be created.

Read-Only

  • created_at (String) Timestamp when the VPC was created.
  • id (String) Unique identifier of the VPC assigned by the API.
  • state (String) Current state of the VPC (e.g., available, pending).
  • subnets (Attributes List) List of subnets within this VPC. (see below for nested schema)

Nested Schema for subnets

Read-Only:

  • cidr_block (String) CIDR block of the subnet.
  • id (String) Unique identifier of the subnet.
  • name (String) Name of the subnet.
  • state (String) Current state of the subnet.

Import

Import is supported using the following syntax:

terraform import arvancloud_vpc.example vpc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx