page_title | subcategory | description |
---|---|---|
twc_vpc Resource - Timeweb Cloud |
Resource for describing needed VPN and provides actual information about its status |
Resource for describing needed VPN and provides actual information about its status
# Example VPC network
resource "twc_vpc" "example-vpc" {
name = "Example VPC"
description = "Some example VPC"
subnet_v4 = "192.168.0.0/24"
location = "ru-1"
}
### Example servers with VPC network
data "twc_presets" "example-preset" {
price_filter {
from = 300
to = 400
}
}
data "twc_os" "example-os" {
name = "ubuntu"
version = "22.04"
}
# With VPC network
resource "twc_server" "example-server-with-local-network" {
name = "Example server with local network"
os_id = data.twc_os.example-os.id
preset_id = data.twc_presets.example-preset.id
local_network {
id = twc_vpc.example-vpc.id
}
}
# With VPC network and specified ID IP
resource "twc_server" "example-server-with-local-network-and-address" {
name = "Example server with local network and address"
os_id = data.twc_os.example-os.id
preset_id = data.twc_presets.example-preset.id
local_network {
id = twc_vpc.example-vpc.id
ip = "192.168.0.15"
}
}
### Example database with VPC network
data "twc_db_preset" "example-db-postgres-preset" {
location = "ru-1"
type = "postgres"
price_filter {
from = 100
to = 200
}
}
resource "twc_db_postgres" "example-postgres" {
name = "example_postgres"
login = "example_login"
password = "example_password"
preset_id = data.twc_db_preset.example-db-postgres-preset.id
autovacuum_analyze_scale_factor = 0.001
bgwriter_delay = 101
bgwriter_lru_maxpages = 102
deadlock_timeout = 103
gin_pending_list_limit = 104
idle_in_transaction_session_timeout = 115
idle_session_timeout = 106
join_collapse_limit = 107
lock_timeout = 108
max_prepared_transactions = 109
max_connections = 110
shared_buffers = 111
wal_buffers = 112
temp_buffers = 113
work_mem = 114
is_external_ip = true
local_network {
id = twc_vpc.example-vpc.id
ip = "192.168.0.14"
}
}
### Example load balancer with VPC network
data "twc_lb_preset" "example-lb-preset" {
requests_per_second = "10K"
price_filter {
from = 100
to = 200
}
}
resource "twc_lb" "example-lb" {
name = "example-lb"
algo = "roundrobin"
is_sticky = false
is_use_proxy = false
is_ssl = false
is_keepalive = false
health_check {
proto = "http"
port = 80
path = "/lala"
inter = 10
timeout = 5
fall = 3
rise = 2
}
ips = []
preset_id = data.twc_lb_preset.example-lb-preset.id
project_id = resource.twc_project.example-project.id
local_network {
id = twc_vpc.example-vpc.id
ip = "192.168.0.20"
}
}
location
(String) Location for VPCname
(String) Name for VPCsubnet_v4
(String) Subnet for VPC in CIDR notation
description
(String) Description for VPC
id
(String) The ID of this resource.