-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
83 lines (75 loc) · 2.29 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# ============================================================
# Example of using IPsec-SGW Terraform module for Yandex Cloud
# ============================================================
# ==================================
# Terraform & Provider Configuration
# ==================================
terraform {
required_providers {
yandex = {
source = "yandex-cloud/yandex"
version = "~> 0.89.0"
}
null = {
source = "hashicorp/null"
version = "~> 3.2.1"
}
local = {
source = "hashicorp/local"
version = "~> 2.4.0"
}
}
}
# =====================
# Call IPsec-SGW module
# =====================
module "ipsec-sgw" {
source = "../"
cloud_id = var.cloud_id
folder_id = var.folder_id
labels = { tag = "ipsec-sgw" }
# ==================================================================
# IPsec profile for both sides (strongSwan keywords values)
# https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html
# ==================================================================
ipsec_policy = {
policy_name = "yc-ipsec"
ike_proposal = "aes128gcm16-prfsha256-ecp256"
esp_proposal = "aes128gcm16"
psk = "Sup@385paS4"
}
# =================================
# Yandex Cloud side: strongSwan SGW
# =================================
yc_subnets = {
net_name = "default"
rt_name = "sgw-rt"
rt_internet_access = false
force_subnets_update = false
prefix_list = ["10.128.0.0/24", "10.129.0.0/24"]
}
yc_sgw = {
name = "yc-sgw"
folder_name = "folder1"
image_folder_id = "b1g4n62gio32v96mdvrb"
image_name = "ipsec-sgw"
zone = "ru-central1-a"
subnet = "192.168.200.0/24"
inside_ip = "192.168.200.10"
admin_name = "admin"
admin_key_path = "~/.ssh/id_ed25519.pub"
}
# =================================
# Remote side: 3rd party IPsec SGW
# =================================
remote_subnets = ["10.10.201.0/24", "10.10.202.0/24"]
remote_sgw = {
name = "Router1"
type = "cisco-iosxe"
outside_ip = "51.250.13.97"
}
}
output "yc_rt_cmd" {
description = "yc cli command for update the routing table."
value = module.ipsec-sgw.yc_rt_cmd
}