Extend network resource fields (#576)
* deprecate nameservers filed * onboard routed field * onboard new ipv4 fields * onboard new ipv6 fields * update examples * update examples * update examples * remove nameserver(deprecated) mapping * make fields computed * Revert "remove nameserver(deprecated) mapping" This reverts commit e4bf1dc184289f3bddc10c5d3b2320966b529649. * remove routed from update payload (not yet supported) * Update docs/resources/network.md Co-authored-by: João Palet <joao.palet@outlook.com> * Update stackit/internal/services/iaas/network/resource.go Co-authored-by: João Palet <joao.palet@outlook.com> * fix the field descriptions * remove ipv6 from examples * use nameservers as rollback value to support deprecated field * extend acceptance tests * add condition that nameserver and ipv4_nameserver cannot be provided at the same time * extend acc test * improve conditions in create payload * adapt modify plan to support update and delete operations * fix acceptance test * deprecate prefixes and create ipv4_prefixes field * fix unit tests * fix update issues * fix linter issues * extend modifyPlan condition * add validateConfig function * Update stackit/internal/services/iaas/network/resource.go Co-authored-by: João Palet <joao.palet@outlook.com> * Update stackit/internal/services/iaas/network/resource.go Co-authored-by: João Palet <joao.palet@outlook.com> * update descriptions * Update stackit/internal/services/iaas/network/resource.go Co-authored-by: João Palet <joao.palet@outlook.com> * Update stackit/internal/services/iaas/network/resource.go Co-authored-by: João Palet <joao.palet@outlook.com> * implement no_gateway field and condition check * implement no_ipv6_gateway field and condition check * update examples * update examples and descriptions * fix linter issues * Update stackit/internal/services/iaas/network/resource.go Co-authored-by: João Palet <joao.palet@outlook.com> * adapt descriptions * apply acceptance comments * adapt conditions in create and update * add plan modifiers * add requiresReplace --------- Co-authored-by: João Palet <joao.palet@outlook.com>
This commit is contained in:
parent
3ac1d50253
commit
b1fb9ab9b6
7 changed files with 857 additions and 60 deletions
|
|
@ -30,9 +30,19 @@ data "stackit_network" "example" {
|
|||
### Read-Only
|
||||
|
||||
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`network_id`".
|
||||
- `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.
|
||||
- `ipv4_prefixes` (List of String) The IPv4 prefixes 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.
|
||||
- `ipv6_prefixes` (List of String) The IPv6 prefixes of the network.
|
||||
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
|
||||
- `name` (String) The name of the network.
|
||||
- `nameservers` (List of String) The nameservers of the network.
|
||||
- `prefixes` (List of String) The prefixes of the network.
|
||||
- `nameservers` (List of String, Deprecated) The nameservers of the network. This field is deprecated and will be removed soon, use `ipv4_nameservers` to configure the nameservers for IPv4.
|
||||
- `prefixes` (List of String, Deprecated) The prefixes of the network. This field is deprecated and will be removed soon, use `ipv4_prefixes` to read the prefixes of the IPv4 networks.
|
||||
- `public_ip` (String) The public IP of the network.
|
||||
- `routed` (Boolean) Shows if the network is routed and therefore accessible from other networks.
|
||||
|
|
|
|||
|
|
@ -13,14 +13,31 @@ Network resource schema. Must have a `region` specified in the provider configur
|
|||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "stackit_network" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
name = "example-network"
|
||||
nameservers = ["1.2.3.4", "5.6.7.8"]
|
||||
ipv4_prefix_length = 24
|
||||
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_prefix_length = 24
|
||||
ipv4_gateway = "10.1.2.3"
|
||||
ipv4_prefix = "10.1.2.0/24"
|
||||
labels = {
|
||||
"key" = "value"
|
||||
}
|
||||
routed = false
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -34,13 +51,25 @@ resource "stackit_network" "example" {
|
|||
|
||||
### 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) The nameservers of the network.
|
||||
- `nameservers` (List of String, Deprecated) The nameservers of the network. This field is deprecated and will be removed soon, 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.
|
||||
- `routed` (Boolean) If set to `true`, the network is routed and therefore accessible from other networks.
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`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) The prefixes of the network.
|
||||
- `prefixes` (List of String, Deprecated) The prefixes of the network. This field is deprecated and will be removed soon, use `ipv4_prefixes` to read the prefixes of the IPv4 networks.
|
||||
- `public_ip` (String) The public IP of the network.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue