Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1c7f643
feat(vpn): Onboarding VPN Connection
s-inter Jun 10, 2026
cd0e6f7
upgrade vpn sdk version
Manuelvaas Jun 11, 2026
ea37e46
add labels and preSharedKey
Manuelvaas Jun 11, 2026
ec2b39c
fix static routes
Manuelvaas Jun 18, 2026
4773cee
fixed validators, datasource and acc tests
Manuelvaas Jun 19, 2026
bedf3dd
generate docs
Manuelvaas Jun 19, 2026
c9acac8
Fixed PreSharedKey
Manuelvaas Jun 19, 2026
70e382b
refactored
Manuelvaas Jun 19, 2026
49dfbf3
fixed linter issues
Manuelvaas Jun 19, 2026
cea8783
fixed nil pointer
Manuelvaas Jun 19, 2026
c351fe9
Merge branch 'main' into si/onboard-VPN-connection
Manuelvaas Jun 19, 2026
e2dbed4
Update stackit/internal/services/vpn/connection/resource.go
Manuelvaas Jun 22, 2026
97354b5
renamed pv and sv variable
Manuelvaas Jun 22, 2026
de6b892
Renamed toTunnelConfiguration -> toTunnelPayload
Manuelvaas Jun 22, 2026
f63797d
refactored mapTunnel function
Manuelvaas Jun 22, 2026
cfb94f2
interface for phases
Manuelvaas Jun 23, 2026
adb55c9
interface for connection payloads
Manuelvaas Jun 23, 2026
73e6903
move description to schema
Manuelvaas Jun 23, 2026
4344a8c
interface for connectionResponse
Manuelvaas Jun 23, 2026
9e71ffc
removed unused parts in create function
Manuelvaas Jun 23, 2026
528a7b0
resolved comments
Manuelvaas Jun 24, 2026
c322d90
Add testing
Manuelvaas Jun 24, 2026
1694ce4
removed manual enabled override
Manuelvaas Jun 24, 2026
9a582c0
fixed linter issue
Manuelvaas Jun 24, 2026
1de193b
fix tunnel
Manuelvaas Jun 25, 2026
40202b3
Merge branch 'main' into si/onboard-VPN-connection
Manuelvaas Jun 25, 2026
cc30e9c
fix tunnel2 nil check in datasource
Manuelvaas Jun 25, 2026
073bddb
removed key version from tunnelmodel init
Manuelvaas Jun 25, 2026
1056ccd
feat(vpn): add proper handling for write-only fields
rubenhoenle Jun 25, 2026
da2b1f5
generate docs
rubenhoenle Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions docs/data-sources/vpn_connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_vpn_connection Data Source - stackit"
subcategory: ""
description: |-
VPN Connection data source schema. Uses the default_region specified in the provider configuration as a fallback in case no region is defined on datasource level.
---

# stackit_vpn_connection (Data Source)

VPN Connection data source schema. Uses the `default_region` specified in the provider configuration as a fallback in case no `region` is defined on datasource level.

## Example Usage

```terraform
data "stackit_vpn_connection" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
gateway_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
connection_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `connection_id` (String) The server-generated UUID of the VPN connection.
- `gateway_id` (String) The UUID of the parent VPN gateway.
- `project_id` (String) STACKIT project ID.

### Read-Only

- `display_name` (String) A user-friendly name for the connection.
- `enabled` (Boolean) Whether this connection is enabled.
- `id` (String) Terraform's internal resource identifier. Structured as "`project_id`,`region`,`gateway_id`,`connection_id`".
- `labels` (Map of String) Map of custom labels.
- `local_subnet` (List of String) List of local IPv4 CIDRs to route through this connection.
- `region` (String) STACKIT region.
- `remote_subnet` (List of String) List of remote IPv4 CIDRs accessible via this connection.
- `static_routes` (List of String) List of static routes (IPv4 CIDRs) for route-based VPN.
- `tunnel1` (Attributes) (see [below for nested schema](#nestedatt--tunnel1))
- `tunnel2` (Attributes) (see [below for nested schema](#nestedatt--tunnel2))

<a id="nestedatt--tunnel1"></a>
### Nested Schema for `tunnel1`

Read-Only:

- `bgp` (Attributes) BGP configuration for this tunnel. (see [below for nested schema](#nestedatt--tunnel1--bgp))
- `peering` (Attributes) Tunnel interface peering configuration. (see [below for nested schema](#nestedatt--tunnel1--peering))
- `phase1` (Attributes) IKE Phase 1 configuration. (see [below for nested schema](#nestedatt--tunnel1--phase1))
- `phase2` (Attributes) IKE Phase 2 configuration. (see [below for nested schema](#nestedatt--tunnel1--phase2))
- `remote_address` (String) Remote peer IPv4 address for this tunnel.

<a id="nestedatt--tunnel1--bgp"></a>
### Nested Schema for `tunnel1.bgp`

Read-Only:

- `remote_asn` (Number) Remote AS number.


<a id="nestedatt--tunnel1--peering"></a>
### Nested Schema for `tunnel1.peering`

Read-Only:

- `local_address` (String) Local tunnel interface IPv4 address.
- `remote_address` (String) Remote tunnel interface IPv4 address.


<a id="nestedatt--tunnel1--phase1"></a>
### Nested Schema for `tunnel1.phase1`

Read-Only:

- `dh_groups` (List of String) Diffie-Hellman groups.
- `encryption_algorithms` (List of String) Encryption algorithms.
- `integrity_algorithms` (List of String) Integrity/hash algorithms.
- `rekey_time` (Number) IKE re-keying time in seconds.


<a id="nestedatt--tunnel1--phase2"></a>
### Nested Schema for `tunnel1.phase2`

Read-Only:

- `dh_groups` (List of String) Diffie-Hellman groups for PFS.
- `dpd_action` (String) DPD timeout action (clear or restart).
- `encryption_algorithms` (List of String) Encryption algorithms.
- `integrity_algorithms` (List of String) Integrity/hash algorithms.
- `rekey_time` (Number) Child SA re-keying time in seconds.
- `start_action` (String) Start action (none or start).



<a id="nestedatt--tunnel2"></a>
### Nested Schema for `tunnel2`

Read-Only:

- `bgp` (Attributes) BGP configuration for this tunnel. (see [below for nested schema](#nestedatt--tunnel2--bgp))
- `peering` (Attributes) Tunnel interface peering configuration. (see [below for nested schema](#nestedatt--tunnel2--peering))
- `phase1` (Attributes) IKE Phase 1 configuration. (see [below for nested schema](#nestedatt--tunnel2--phase1))
- `phase2` (Attributes) IKE Phase 2 configuration. (see [below for nested schema](#nestedatt--tunnel2--phase2))
- `remote_address` (String) Remote peer IPv4 address for this tunnel.

<a id="nestedatt--tunnel2--bgp"></a>
### Nested Schema for `tunnel2.bgp`

Read-Only:

- `remote_asn` (Number) Remote AS number.


<a id="nestedatt--tunnel2--peering"></a>
### Nested Schema for `tunnel2.peering`

Read-Only:

- `local_address` (String) Local tunnel interface IPv4 address.
- `remote_address` (String) Remote tunnel interface IPv4 address.


<a id="nestedatt--tunnel2--phase1"></a>
### Nested Schema for `tunnel2.phase1`

Read-Only:

- `dh_groups` (List of String) Diffie-Hellman groups.
- `encryption_algorithms` (List of String) Encryption algorithms.
- `integrity_algorithms` (List of String) Integrity/hash algorithms.
- `rekey_time` (Number) IKE re-keying time in seconds.


<a id="nestedatt--tunnel2--phase2"></a>
### Nested Schema for `tunnel2.phase2`

Read-Only:

- `dh_groups` (List of String) Diffie-Hellman groups for PFS.
- `dpd_action` (String) DPD timeout action (clear or restart).
- `encryption_algorithms` (List of String) Encryption algorithms.
- `integrity_algorithms` (List of String) Integrity/hash algorithms.
- `rekey_time` (Number) Child SA re-keying time in seconds.
- `start_action` (String) Start action (none or start).
218 changes: 218 additions & 0 deletions docs/resources/vpn_connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_vpn_connection Resource - stackit"
subcategory: ""
description: |-
VPN Connection resource schema. Uses the default_region specified in the provider configuration as a fallback in case no region is defined on resource level.
---

# stackit_vpn_connection (Resource)

VPN Connection resource schema. Uses the `default_region` specified in the provider configuration as a fallback in case no `region` is defined on resource level.

## Example Usage

```terraform
resource "stackit_vpn_connection" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
gateway_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
display_name = "example-vpn-connection"

tunnel1 = {
remote_address = "198.51.100.10"
pre_shared_key_wo = "example-super-secret-key-tunnel1"

phase1 = {
dh_groups = ["ecp384"]
encryption_algorithms = ["aes256"]
integrity_algorithms = ["sha2_384"]
}

phase2 = {
dh_groups = ["ecp384"]
encryption_algorithms = ["aes256"]
integrity_algorithms = ["sha2_384"]
}
}

tunnel2 = {
remote_address = "203.0.113.10"
pre_shared_key_wo = "example-super-secret-key-tunnel2"

phase1 = {
dh_groups = ["ecp384"]
encryption_algorithms = ["aes256"]
integrity_algorithms = ["sha2_384"]
}

phase2 = {
dh_groups = ["ecp384"]
encryption_algorithms = ["aes256"]
integrity_algorithms = ["sha2_384"]
}
}
}

# Only use the import statement, if you want to import an existing VPN connection
import {
to = stackit_vpn_connection.example
id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,eu01,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `display_name` (String) A user-friendly name for the connection. Must start and end with an alphanumeric character, may contain hyphens, and be 1-63 characters long.
- `gateway_id` (String) The UUID of the parent VPN gateway.
- `project_id` (String) STACKIT project ID.
- `tunnel1` (Attributes) Configuration for the IPsec tunnel1

~> Write-Only argument `pre_shared_key_wo` is available to use in place of `pre_shared_key`. Write-Only arguments are supported in HashiCorp Terraform 1.11.0 and later. [Learn more](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments). (see [below for nested schema](#nestedatt--tunnel1))
- `tunnel2` (Attributes) Configuration for the IPsec tunnel2

~> Write-Only argument `pre_shared_key_wo` is available to use in place of `pre_shared_key`. Write-Only arguments are supported in HashiCorp Terraform 1.11.0 and later. [Learn more](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments). (see [below for nested schema](#nestedatt--tunnel2))

### Optional

- `enabled` (Boolean) Whether this connection is enabled. Defaults to true.
- `labels` (Map of String) Map of custom labels.
- `local_subnet` (List of String) List of local IPv4 CIDRs to route through this connection. Optional for route-based and BGP configurations (defaults to 0.0.0.0/0). Mandatory for policy-based.
- `region` (String) STACKIT region.
- `remote_subnet` (List of String) List of remote IPv4 CIDRs accessible via this connection. Optional for route-based and BGP configurations (defaults to 0.0.0.0/0). Mandatory for policy-based.
- `static_routes` (List of String) List of static routes (IPv4 CIDRs) for route-based VPN. Mandatory for ROUTE_BASED gateways.

### Read-Only

- `connection_id` (String) The server-generated UUID of the VPN connection.
- `id` (String) Terraform's internal resource identifier. Structured as "`project_id`,`region`,`gateway_id`,`connection_id`".

<a id="nestedatt--tunnel1"></a>
### Nested Schema for `tunnel1`

Required:

- `phase1` (Attributes) (see [below for nested schema](#nestedatt--tunnel1--phase1))
- `phase2` (Attributes) (see [below for nested schema](#nestedatt--tunnel1--phase2))
- `remote_address` (String) Remote IPv4 address for the tunnel endpoint.

Optional:

- `bgp` (Attributes) (see [below for nested schema](#nestedatt--tunnel1--bgp))
- `peering` (Attributes) (see [below for nested schema](#nestedatt--tunnel1--peering))
- `pre_shared_key` (String, Sensitive) Pre-shared key for the IPsec tunnel. Minimum 20 characters. Write-only argument `pre_shared_key_wo` should be preferred.
- `pre_shared_key_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Pre-shared key for the IPsec tunnel. Minimum 20 characters. Write-only - never stored in state and never returned by the API. To rotate the key, update this value AND increment pre_shared_key_wo_version. Changing this field alone will NOT trigger an update.
- `pre_shared_key_wo_version` (Number) User-managed rotation counter for the pre-shared key. Must be incremented every time pre_shared_key_wo is changed. Terraform diffs this field to detect key rotations - changing pre_shared_key_wo alone will NOT trigger an update because it is write-only and never stored in state.

<a id="nestedatt--tunnel1--phase1"></a>
### Nested Schema for `tunnel1.phase1`

Required:

- `encryption_algorithms` (List of String) Encryption algorithms for Phase 1. Possible values are: `aes256`, `aes128gcm16`, `aes256gcm16`.
- `integrity_algorithms` (List of String) Integrity algorithms for Phase 1. Possible values are: `sha1`, `sha2_256`, `sha2_384`.

Optional:

- `dh_groups` (List of String) Diffie-Hellman groups for key exchange. Possible values are: `modp1024`, `modp2048`, `ecp256`, `ecp384`, `modp2048s256`.
- `rekey_time` (Number) Time to schedule an IKE re-keying in seconds. Range: 900-28800. Default: 14400.


<a id="nestedatt--tunnel1--phase2"></a>
### Nested Schema for `tunnel1.phase2`

Required:

- `encryption_algorithms` (List of String) Encryption algorithms for Phase 2. Possible values are: `aes256`, `aes128gcm16`, `aes256gcm16`.
- `integrity_algorithms` (List of String) Integrity algorithms for Phase 2. Possible values are: `sha1`, `sha2_256`, `sha2_384`.

Optional:

- `dh_groups` (List of String) Diffie-Hellman groups for Phase 2. Possible values are: `modp1024`, `modp2048`, `ecp256`, `ecp384`, `modp2048s256`.
- `dpd_action` (String) Action to perform on DPD timeout. Default: 'restart'. Possible values are: `clear`, `restart`.
- `rekey_time` (Number) Time to schedule a Child SA re-keying in seconds. Range: 900-3600. Default: 3600.
- `start_action` (String) Action to perform after loading the connection configuration. Default: 'start'. Possible values are: `none`, `start`.


<a id="nestedatt--tunnel1--bgp"></a>
### Nested Schema for `tunnel1.bgp`

Required:

- `remote_asn` (Number) Remote ASN for BGP peering (private ASN range, 64512-4294967294).


<a id="nestedatt--tunnel1--peering"></a>
### Nested Schema for `tunnel1.peering`

Required:

- `local_address` (String) Local tunnel interface IPv4 address.
- `remote_address` (String) Remote tunnel interface IPv4 address.



<a id="nestedatt--tunnel2"></a>
### Nested Schema for `tunnel2`

Required:

- `phase1` (Attributes) (see [below for nested schema](#nestedatt--tunnel2--phase1))
- `phase2` (Attributes) (see [below for nested schema](#nestedatt--tunnel2--phase2))
- `remote_address` (String) Remote IPv4 address for the tunnel endpoint.

Optional:

- `bgp` (Attributes) (see [below for nested schema](#nestedatt--tunnel2--bgp))
- `peering` (Attributes) (see [below for nested schema](#nestedatt--tunnel2--peering))
- `pre_shared_key` (String, Sensitive) Pre-shared key for the IPsec tunnel. Minimum 20 characters. Write-only argument `pre_shared_key_wo` should be preferred.
- `pre_shared_key_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Pre-shared key for the IPsec tunnel. Minimum 20 characters. Write-only - never stored in state and never returned by the API. To rotate the key, update this value AND increment pre_shared_key_wo_version. Changing this field alone will NOT trigger an update.
- `pre_shared_key_wo_version` (Number) User-managed rotation counter for the pre-shared key. Must be incremented every time pre_shared_key_wo is changed. Terraform diffs this field to detect key rotations - changing pre_shared_key_wo alone will NOT trigger an update because it is write-only and never stored in state.

<a id="nestedatt--tunnel2--phase1"></a>
### Nested Schema for `tunnel2.phase1`

Required:

- `encryption_algorithms` (List of String) Encryption algorithms for Phase 1. Possible values are: `aes256`, `aes128gcm16`, `aes256gcm16`.
- `integrity_algorithms` (List of String) Integrity algorithms for Phase 1. Possible values are: `sha1`, `sha2_256`, `sha2_384`.

Optional:

- `dh_groups` (List of String) Diffie-Hellman groups for key exchange. Possible values are: `modp1024`, `modp2048`, `ecp256`, `ecp384`, `modp2048s256`.
- `rekey_time` (Number) Time to schedule an IKE re-keying in seconds. Range: 900-28800. Default: 14400.


<a id="nestedatt--tunnel2--phase2"></a>
### Nested Schema for `tunnel2.phase2`

Required:

- `encryption_algorithms` (List of String) Encryption algorithms for Phase 2. Possible values are: `aes256`, `aes128gcm16`, `aes256gcm16`.
- `integrity_algorithms` (List of String) Integrity algorithms for Phase 2. Possible values are: `sha1`, `sha2_256`, `sha2_384`.

Optional:

- `dh_groups` (List of String) Diffie-Hellman groups for Phase 2. Possible values are: `modp1024`, `modp2048`, `ecp256`, `ecp384`, `modp2048s256`.
- `dpd_action` (String) Action to perform on DPD timeout. Default: 'restart'. Possible values are: `clear`, `restart`.
- `rekey_time` (Number) Time to schedule a Child SA re-keying in seconds. Range: 900-3600. Default: 3600.
- `start_action` (String) Action to perform after loading the connection configuration. Default: 'start'. Possible values are: `none`, `start`.


<a id="nestedatt--tunnel2--bgp"></a>
### Nested Schema for `tunnel2.bgp`

Required:

- `remote_asn` (Number) Remote ASN for BGP peering (private ASN range, 64512-4294967294).


<a id="nestedatt--tunnel2--peering"></a>
### Nested Schema for `tunnel2.peering`

Required:

- `local_address` (String) Local tunnel interface IPv4 address.
- `remote_address` (String) Remote tunnel interface IPv4 address.
5 changes: 5 additions & 0 deletions examples/data-sources/stackit_vpn_connection/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data "stackit_vpn_connection" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
gateway_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
connection_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Loading
Loading