Skip to content

Commit

Permalink
Merge pull request #94 from yunkon-kim/241029-15
Browse files Browse the repository at this point in the history
Staging v0.0.10
  • Loading branch information
yunkon-kim authored Oct 29, 2024
2 parents 1e35006 + 9c6a8fe commit 35660a4
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 39 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ networks:

services:
mc-terrarium:
image: cloudbaristaorg/mc-terrarium:0.0.9
image: cloudbaristaorg/mc-terrarium:0.0.10
container_name: mc-terrarium
build:
context: .
Expand All @@ -22,7 +22,7 @@ services:
- ./secrets:/app/secrets:ro # GCP credentials
- ./container-volume/mc-terrarium-container/.terrarium:/app/.terrarium
environment:
# - TERRARIUM_ROOT=/app
- TERRARIUM_ROOT=/app
# - TERRARIUM_SELF_ENDPOINT=localhost:8055
# - TERRARIUM_API_ALLOW_ORIGINS=*
# - TERRARIUM_API_AUTH_ENABLED=true
Expand All @@ -33,7 +33,7 @@ services:
# - TERRARIUM_LOGFILE_MAXBACKUPS=3
# - TERRARIUM_LOGFILE_MAXAGE=30
# - TERRARIUM_LOGFILE_COMPRESS=false
# - TERRARIUM_LOGLEVEL=info
- TERRARIUM_LOGLEVEL=info
# - TERRARIUM_LOGWRITER=both
# - TERRARIUM_NODE_ENV=production
# - TERRARIUM_AUTOCONTROL_DURATION_MS=10000
Expand Down
129 changes: 129 additions & 0 deletions pkg/api/rest/model/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,132 @@ type TfVarsGcpAzureVpnTunnel struct {
// AzureSubnetName string `json:"azure-subnet-name" default:"tr-azure-subnet-0"`
// GcpVpcSubnetworkName string `json:"gcp-vpc-subnetwork-name" default:"tr-gcp-subnet-1"`
}

type OutputGcpAwsVpnInfo struct {
Terrarium struct {
ID string `json:"id"`
} `json:"terrarium"`
AWS struct {
VpnGateway struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
VpcID string `json:"vpc_id"`
} `json:"vpn_gateway"`
CustomerGateways []struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
IPAddress string `json:"ip_address"`
BgpAsn string `json:"bgp_asn"`
} `json:"customer_gateways"`
VpnConnections []struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Tunnel1Address string `json:"tunnel1_address"`
Tunnel2Address string `json:"tunnel2_address"`
} `json:"vpn_connections"`
} `json:"aws"`
GCP struct {
Router struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Network string `json:"network"`
BgpAsn int `json:"bgp_asn"`
} `json:"router"`
HaVpnGateway struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Network string `json:"network"`
IPAddresses []string `json:"ip_addresses"`
} `json:"ha_vpn_gateway"`
VpnTunnels []struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
IkeVersion int `json:"ike_version"`
Interface int `json:"interface"`
} `json:"vpn_tunnels"`
} `json:"gcp"`
}

type OutputGcpAzureVpnInfo struct {
Terrarium struct {
ID string `json:"id"`
} `json:"terrarium"`
Azure struct {
VirtualNetworkGateway struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Location string `json:"location"`
VpnType string `json:"vpn_type"`
Sku string `json:"sku"`
BgpSettings struct {
ASN int `json:"asn"`
PeeringAddresses []struct {
IPAddressConfig string `json:"ip_configuration"`
Address string `json:"address"`
} `json:"peering_addresses"`
} `json:"bgp_settings"`
} `json:"virtual_network_gateway"`
PublicIPs struct {
IP1 struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
IPAddress string `json:"ip_address"`
} `json:"ip1"`
IP2 struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
IPAddress string `json:"ip_address"`
} `json:"ip2"`
} `json:"public_ips"`
Connections []struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Type string `json:"type"`
EnableBgp bool `json:"enable_bgp"`
} `json:"connections"`
} `json:"azure"`
GCP struct {
Router struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Network string `json:"network"`
Bgp struct {
ASN int `json:"asn"`
AdvertiseMode string `json:"advertise_mode"`
} `json:"bgp"`
} `json:"router"`
HaVpnGateway struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Network string `json:"network"`
Interfaces []struct {
} `json:"interfaces"`
} `json:"ha_vpn_gateway"`
VpnTunnels []struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
ID string `json:"id"`
Router string `json:"router"`
Interface int `json:"interface"`
} `json:"vpn_tunnels"`
BgpPeers []struct {
ResourceType string `json:"resource_type"`
Name string `json:"name"`
PeerIP string `json:"peer_ip"`
PeerASN int `json:"peer_asn"`
InterfaceName string `json:"interface_name"`
} `json:"bgp_peers"`
} `json:"gcp"`
}
72 changes: 36 additions & 36 deletions templates/vpn/gcp-azure/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,90 +94,90 @@ output "vpn_info" {
peering_addresses = [
{
ip_configuration = "${var.terrarium-id}-vnetGatewayConfig1"
address = azurerm_virtual_network_gateway.vpn_gw_1.bgp_settings[0].peering_addresses[0].apipa_addresses[0]
address = azurerm_virtual_network_gateway.vpn_gw_1.bgp_settings[0].peering_addresses[0].apipa_addresses[0]
},
{
ip_configuration = "${var.terrarium-id}-vnetGatewayConfig2"
address = azurerm_virtual_network_gateway.vpn_gw_1.bgp_settings[0].peering_addresses[1].apipa_addresses[0]
address = azurerm_virtual_network_gateway.vpn_gw_1.bgp_settings[0].peering_addresses[1].apipa_addresses[0]
}
]
}
}
public_ips = {
ip1 = {
resource_type = "azurerm_public_ip"
name = azurerm_public_ip.vpn_gw_pub_ip_1.name
id = azurerm_public_ip.vpn_gw_pub_ip_1.id
ip_address = azurerm_public_ip.vpn_gw_pub_ip_1.ip_address
name = azurerm_public_ip.vpn_gw_pub_ip_1.name
id = azurerm_public_ip.vpn_gw_pub_ip_1.id
ip_address = azurerm_public_ip.vpn_gw_pub_ip_1.ip_address
}
ip2 = {
resource_type = "azurerm_public_ip"
name = azurerm_public_ip.vpn_gw_pub_ip_2.name
id = azurerm_public_ip.vpn_gw_pub_ip_2.id
ip_address = azurerm_public_ip.vpn_gw_pub_ip_2.ip_address
name = azurerm_public_ip.vpn_gw_pub_ip_2.name
id = azurerm_public_ip.vpn_gw_pub_ip_2.id
ip_address = azurerm_public_ip.vpn_gw_pub_ip_2.ip_address
}
}
connections = [
{
resource_type = "azurerm_virtual_network_gateway_connection"
name = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.name
id = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.id
type = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.type
enable_bgp = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.enable_bgp
name = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.name
id = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.id
type = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.type
enable_bgp = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_1.enable_bgp
},
{
resource_type = "azurerm_virtual_network_gateway_connection"
name = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.name
id = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.id
type = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.type
enable_bgp = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.enable_bgp
name = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.name
id = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.id
type = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.type
enable_bgp = azurerm_virtual_network_gateway_connection.gcp_and_azure_cnx_2.enable_bgp
}
]
}
gcp = {
router = {
resource_type = "google_compute_router"
name = google_compute_router.router_1.name
id = google_compute_router.router_1.id
network = google_compute_router.router_1.network
name = google_compute_router.router_1.name
id = google_compute_router.router_1.id
network = google_compute_router.router_1.network
bgp = {
asn = google_compute_router.router_1.bgp[0].asn
advertise_mode = google_compute_router.router_1.bgp[0].advertise_mode
asn = google_compute_router.router_1.bgp[0].asn
advertise_mode = google_compute_router.router_1.bgp[0].advertise_mode
}
}
ha_vpn_gateway = {
resource_type = "google_compute_ha_vpn_gateway"
name = google_compute_ha_vpn_gateway.ha_vpn_gw_1.name
id = google_compute_ha_vpn_gateway.ha_vpn_gw_1.id
network = google_compute_ha_vpn_gateway.ha_vpn_gw_1.network
interfaces = google_compute_ha_vpn_gateway.ha_vpn_gw_1.vpn_interfaces
name = google_compute_ha_vpn_gateway.ha_vpn_gw_1.name
id = google_compute_ha_vpn_gateway.ha_vpn_gw_1.id
network = google_compute_ha_vpn_gateway.ha_vpn_gw_1.network
interfaces = google_compute_ha_vpn_gateway.ha_vpn_gw_1.vpn_interfaces
}
vpn_tunnels = [
{
resource_type = "google_compute_vpn_tunnel"
name = google_compute_vpn_tunnel.vpn_tunnel_1.name
id = google_compute_vpn_tunnel.vpn_tunnel_1.id
router = google_compute_vpn_tunnel.vpn_tunnel_1.router
interface = google_compute_vpn_tunnel.vpn_tunnel_1.vpn_gateway_interface
name = google_compute_vpn_tunnel.vpn_tunnel_1.name
id = google_compute_vpn_tunnel.vpn_tunnel_1.id
router = google_compute_vpn_tunnel.vpn_tunnel_1.router
interface = google_compute_vpn_tunnel.vpn_tunnel_1.vpn_gateway_interface
},
{
resource_type = "google_compute_vpn_tunnel"
name = google_compute_vpn_tunnel.vpn_tunnel_2.name
id = google_compute_vpn_tunnel.vpn_tunnel_2.id
router = google_compute_vpn_tunnel.vpn_tunnel_2.router
interface = google_compute_vpn_tunnel.vpn_tunnel_2.vpn_gateway_interface
name = google_compute_vpn_tunnel.vpn_tunnel_2.name
id = google_compute_vpn_tunnel.vpn_tunnel_2.id
router = google_compute_vpn_tunnel.vpn_tunnel_2.router
interface = google_compute_vpn_tunnel.vpn_tunnel_2.vpn_gateway_interface
}
]
bgp_peers = [
{
resource_type = "google_compute_router_peer"
resource_type = "google_compute_router_peer"
name = google_compute_router_peer.router_peer_1.name
peer_ip = google_compute_router_peer.router_peer_1.peer_ip_address
peer_asn = google_compute_router_peer.router_peer_1.peer_asn
interface_name = google_compute_router_peer.router_peer_1.interface
},
{
resource_type = "google_compute_router_peer"
resource_type = "google_compute_router_peer"
name = google_compute_router_peer.router_peer_2.name
peer_ip = google_compute_router_peer.router_peer_2.peer_ip_address
peer_asn = google_compute_router_peer.router_peer_2.peer_asn
Expand All @@ -186,4 +186,4 @@ output "vpn_info" {
]
}
}
}
}

0 comments on commit 35660a4

Please sign in to comment.