terraform-provider-stackitp.../docs/resources/network.md
Ruben Hönle 53a3697850
feat(iaas): support for v2 API (#1070)
relates to STACKITTPR-313
2025-12-17 15:40:46 +01:00

90 lines
4.3 KiB
Markdown

---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_network Resource - stackit"
subcategory: ""
description: |-
Network resource schema. Must have a region specified in the provider configuration.
~> Behavior of not configured ipv4_nameservers will change from January 2026. When ipv4_nameservers is not set, it will be set to the network area's default_nameservers.
To prevent any nameserver configuration, the ipv4_nameservers attribute should be explicitly set to an empty list [].
In cases where ipv4_nameservers are defined within the resource, the existing behavior will remain unchanged.
---
# stackit_network (Resource)
Network resource schema. Must have a `region` specified in the provider configuration.
~> Behavior of not configured `ipv4_nameservers` will change from January 2026. When `ipv4_nameservers` is not set, it will be set to the network area's `default_nameservers`.
To prevent any nameserver configuration, the `ipv4_nameservers` attribute should be explicitly set to an empty list `[]`.
In cases where `ipv4_nameservers` are defined within the resource, the existing behavior will remain unchanged.
## Example Usage
```terraform
resource "stackit_network" "example_with_name" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-with-name"
}
resource "stackit_network" "example_routed_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-routed-network"
labels = {
"key" = "value"
}
routed = true
}
resource "stackit_network" "example_non_routed_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-non-routed-network"
ipv4_nameservers = ["1.2.3.4", "5.6.7.8"]
ipv4_gateway = "10.1.2.3"
ipv4_prefix = "10.1.2.0/24"
labels = {
"key" = "value"
}
routed = false
}
# Only use the import statement, if you want to import an existing network
# Note: There will be a conflict which needs to be resolved manually.
# These attributes cannot be configured together: [ipv4_prefix,ipv4_prefix_length,ipv4_gateway]
import {
to = stackit_network.import-example
id = "${var.project_id},${var.region},${var.network_id}"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `name` (String) The name of the network.
- `project_id` (String) STACKIT project ID to which the network is associated.
### Optional
- `ipv4_gateway` (String) The IPv4 gateway of a network. If not specified, the first IP of the network will be assigned as the gateway.
- `ipv4_nameservers` (List of String) The IPv4 nameservers of the network.
- `ipv4_prefix` (String) The IPv4 prefix of the network (CIDR).
- `ipv4_prefix_length` (Number) The IPv4 prefix length of the network.
- `ipv6_gateway` (String) The IPv6 gateway of a network. If not specified, the first IP of the network will be assigned as the gateway.
- `ipv6_nameservers` (List of String) The IPv6 nameservers of the network.
- `ipv6_prefix` (String) The IPv6 prefix of the network (CIDR).
- `ipv6_prefix_length` (Number) The IPv6 prefix length of the network.
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
- `nameservers` (List of String, Deprecated) The nameservers of the network. This field is deprecated and will be removed in January 2026, use `ipv4_nameservers` to configure the nameservers for IPv4.
- `no_ipv4_gateway` (Boolean) If set to `true`, the network doesn't have a gateway.
- `no_ipv6_gateway` (Boolean) If set to `true`, the network doesn't have a gateway.
- `region` (String) The resource region. If not defined, the provider region is used.
- `routed` (Boolean) If set to `true`, the network is routed and therefore accessible from other networks.
- `routing_table_id` (String) The ID of the routing table associated with the network.
### Read-Only
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`region`,`network_id`".
- `ipv4_prefixes` (List of String) The IPv4 prefixes of the network.
- `ipv6_prefixes` (List of String) The IPv6 prefixes of the network.
- `network_id` (String) The network ID.
- `prefixes` (List of String, Deprecated) The prefixes of the network. This field is deprecated and will be removed in January 2026, use `ipv4_prefixes` to read the prefixes of the IPv4 networks.
- `public_ip` (String) The public IP of the network.