Terraform: IPsec site creation with Responder-only and destination type FQDN possible?
Hi,
see subject.
When trying to setup an ipsec site (IKEv2) in responder only mode and with destination type FQDN for primary and secondary tunnel, terraform (in fact opentofu), gives this error:
│ Error: Cato API error in SiteAddIpsecIkeV2SiteTunnels
│
│ with cato_ipsec_site.Vienna,
│ on main.tf line 73, in resource "cato_ipsec_site" "Vienna":
│ 73: resource "cato_ipsec_site" "Vienna" {
│
│ {"networkErrors":{"code":422,"message":"Response body {\"errors\":[{\"message\":\"input:
│ variable.updateIpsecIkeV2SiteTunnelsInput.primary.tunnels[0].tunnelId is not a valid
│ IPSecV2InterfaceId\",\"path\":[\"variable\",\"updateIpsecIkeV2SiteTunnelsInput\",\"primary\",\"tunnels\",0,\"tunnelId\"]}],\"data\":null}"},"graphqlErrors":[{"message":"input:
│ variable.updateIpsecIkeV2SiteTunnelsInput.primary.tunnels[0].tunnelId is not a valid
│ IPSecV2InterfaceId","path":["variable","updateIpsecIkeV2SiteTunnelsInput","primary","tunnels",0,"tunnelId"]}]}
╵
That appears when adding the "tunnels" section.
Without that section, a deployment if possible.
Obviously, the tunnels section is required.
--------------------snip--------------------
connection_mode = "RESPONDER_ONLY"
identification_type = "IPV4"
primary = {
destination_type = "FQDN"
tunnels = [
{
public_site_ip = "10.10.10.10"
psk = "abcABC1234567!!"
//last_mile_bw = {
//downstream = 10
//upstream = 10
}
]
}
---------------snap-------------------------------------
Is that supported with the terraform provider currently?
Thanks,
Christian
Hi Christian,
I hope the info is still useful as it has been a while since you asked.
Here is a working example of a module to achieve what you require.
Currently it seems we need to update the provider as it requires us to give a value for "primary_cato_pop_ip" when in this example it is not actually needed. If you just use any allocated IP from your account it should suffice.module "ipsec-generic-ha-fully-customized" {
source = "catonetworks/ipsec-generic/cato"
ha_tunnels = false
site_name = "My-Cato-IPSec-Site-ha"
site_description = "IPSec Example Site"
native_network_range = "172.100.0.0/24"
primary_cato_pop_ip = "216.252.178.46" # Currently required but will be removed in a future version of the module, you can use the IP of any Cato IP address in your accounts Allocation.
primary_pop_location_id = "19" # Primary POP Location ID (e.g., 19 for London)
cato_local_networks = ["10.41.0.0/16", "10.254.254.0/24"]
peer_networks = ["servers:172.100.0.0/24", "desktops:172.100.1.0/24"]
peer_primary_public_ip = null
peer_secondary_public_ip = null
cato_connectionMode = "RESPONDER_ONLY"
primary_destination_type = "FQDN"
cato_identificationType = "FQDN"
downstream_bw = 100
upstream_bw = 100
site_location = {
city = "New York City"
country_code = "US"
state_code = "US-NY"
timezone = "America/New_York"
}
}