# ionoscloud\_vpn\_wireguard\_gateway

## Overview

The `ionoscloud_vpn_wireguard_gateway` resource manages a WireGuard Gateway within the IONOS Cloud infrastructure. This resource facilitates the creation, management, and deletion of WireGuard VPN Gateways, enabling secure connections between your network resources.

## Example Usage

```hcl
resource "ionoscloud_datacenter" "datacenter_example" {
  name = "datacenter_example"
  location = "de/fra"
}
resource "ionoscloud_ipblock" "ipblock_example" {
  location = "de/fra"
  size = 1
  name = "ipblock_example"
}

resource "ionoscloud_lan" "lan_example" {
  name = "lan_example"
  datacenter_id = ionoscloud_datacenter.datacenter_example.id
}

resource "ionoscloud_vpn_wireguard_gateway" "gateway" {
  location = "de/fra"
  name = "gateway_example"
  description = "description"
  private_key = "private"

  gateway_ip = ionoscloud_ipblock.ipblock_example.ips[0]
  interface_ipv4_cidr =  "192.168.1.100/24"
  connections   {
    datacenter_id   =  ionoscloud_datacenter.datacenter_example.id
    lan_id          =  ionoscloud_lan.lan_example.id
    ipv4_cidr       =  "192.168.1.108/24"
  }
  maintenance_window {
    day_of_the_week       = "Monday"
    time                  = "09:00:00"
  }
  tier = "STANDARD"
}
```

## Argument Reference

The following arguments are supported by the `vpn_wireguard_gateway` resource:

* `location` - (Optional)\[String] The location of the WireGuard Gateway. Supported locations: de/fra, de/fra/2, de/txl, es/vit, gb/bhx, gb/lhr, us/ewr, us/las, us/mci, fr/par.
* `name` - (Required)\[String] The name of the WireGuard Gateway.
* `description` - (Optional)\[String] A description of the WireGuard Gateway.
* `endpoint` - (Optional, Block) The endpoint configuration for the WireGuard Gateway. This block supports fields documented below.
* `private_key` - (Required)\[String] The private key for the WireGuard Gateway. To be created with the wg utility.
* `gateway_ip` - (Required)\[String] The IP address of the WireGuard Gateway.
* `interface_ipv4_cidr` - (Optional)\[String] The IPv4 CIDR for the WireGuard Gateway interface.
* `interface_ipv6_cidr` - (Optional)\[String] The IPv6 CIDR for the WireGuard Gateway interface.
* `connections` - (Required)\[Block] The connection configuration for the WireGuard Gateway. This block supports fields documented below.
  * `datacenter_id` - (Required)\[String] The ID of the datacenter where the WireGuard Gateway is located.
  * `lan_id` - (Required)\[String] The ID of the LAN where the WireGuard Gateway is connected.
  * `ipv4_cidr` - (Required)\[String] A LAN IPv4 address in CIDR notation that will be assigned to the VPN Gateway. This will be the private gateway address for LAN clients to route traffic over the VPN Gateway, this should be within the subnet already assigned to the LAN.
  * `ipv6_cidr` - (Optional)\[String] A LAN IPv6 address in CIDR notation that will be assigned to the VPN Gateway. This will be the private gateway address for LAN clients to route traffic over the VPN Gateway, this should be within the subnet already assigned to the LAN.
* `maintenance_window` - (Optional)(Computed) A weekly 4 hour-long window, during which maintenance might occur.
  * `time` - (Required)\[string] Start of the maintenance window in UTC time.
  * `day_of_the_week` - (Required)\[string] The name of the week day.
* `tier` - (Optional)(Computed)\[string] Gateway performance options. See product documentation for full details. Options: STANDARD, STANDARD\_HA, ENHANCED, ENHANCED\_HA, PREMIUM, PREMIUM\_HA.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `status` - (Computed)\[String] The current status of the WireGuard Gateway.
* `public_key` - (Computed)\[String] The public key for the WireGuard Gateway.
*

> **⚠ NOTE:** `IONOS_API_URL_VPN` can be used to set a custom API URL for the resource. `location` field needs to be empty, otherwise it will override the custom API URL. Setting `endpoint` or `IONOS_API_URL` does not have any effect.

## Import

WireGuard Gateways can be imported using their ID:

```shell
terraform import ionoscloud_vpn_wireguard_gateway.example_gateway location:id
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/terraform-provider/resources/vpn_wireguard_gateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
