diff --git a/docker-compose.yaml b/docker-compose.yaml index 5da587d..4be84be 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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: . @@ -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 @@ -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 diff --git a/pkg/api/rest/model/vpn.go b/pkg/api/rest/model/vpn.go index 3d1f362..09c361e 100644 --- a/pkg/api/rest/model/vpn.go +++ b/pkg/api/rest/model/vpn.go @@ -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"` +} diff --git a/templates/vpn/gcp-azure/output.tf b/templates/vpn/gcp-azure/output.tf index 3a5099f..3d90925 100644 --- a/templates/vpn/gcp-azure/output.tf +++ b/templates/vpn/gcp-azure/output.tf @@ -94,11 +94,11 @@ 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] } ] } @@ -106,78 +106,78 @@ output "vpn_info" { 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 @@ -186,4 +186,4 @@ output "vpn_info" { ] } } -} \ No newline at end of file +}