Onboard iaas network area (#500)

* Onboard network-area resource (#469)

* onboard network-area resource

* fix update network ranges

* fix linter issues

* add organization id to test util

* add examples

* change project count to computed and adapt unit tests

* extend acceptance tests

* add docs

* fix linter issues

* add datasource to provider

* remove routes from the datasource schema

* remove obsolete api cals

* remove raw response from create network area

* change network ranges to list of objects

* update examples

* fix linter issues

* Update stackit/internal/services/iaas/networkarea/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* add network range id to schema

* map network_range_id

* fix unit tests

* adapt acceptance test

* fix acceptance tests

* Update stackit/internal/services/iaas/iaas_acc_test.go

Co-authored-by: João Palet <joao.palet@outlook.com>

---------

Co-authored-by: João Palet <joao.palet@outlook.com>

* Add network area to beta resources list (#481)

* add network area to beta resources list

* add accidentally removed line

* add accidentally removed line

* Fix multi range creation issue (#483)

* fix multi range creation issue

* fix network range update issue

* fix some unit tests

* fix order issue

* Update stackit/internal/services/iaas/networkarea/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* add unit test to cover the reconciled list

---------

Co-authored-by: João Palet <joao.palet@outlook.com>

* Onboard IaaS network area route (#491)

* onboard network area route

* generate docs

* add route to beta resources

* extend acceptance test

* fix import id handling

* Update next_hop description

Co-authored-by: João Palet <joao.palet@outlook.com>

* Update prefix description

Co-authored-by: João Palet <joao.palet@outlook.com>

* change descriptions in datasource

* add IP and CIDR validators

* use requiresReplace in resource

* improve error logs

* change the create response handling

* update docs

* change route and route id detection

---------

Co-authored-by: João Palet <joao.palet@outlook.com>

---------

Co-authored-by: João Palet <joao.palet@outlook.com>
This commit is contained in:
GokceGK 2024-08-09 12:38:35 +02:00 committed by GitHub
parent 2a923dc4b6
commit b58bd0f640
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 3077 additions and 8 deletions

View file

@ -0,0 +1,51 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_network_area Data Source - stackit"
subcategory: ""
description: |-
Network area datasource schema. Must have a region specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
---
# stackit_network_area (Data Source)
Network area datasource schema. Must have a `region` specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
## Example Usage
```terraform
data "stackit_network_area" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `network_area_id` (String) The network area ID.
- `organization_id` (String) STACKIT organization ID to which the network area is associated.
### Read-Only
- `default_nameservers` (List of String) List of DNS Servers/Nameservers.
- `default_prefix_length` (Number) The default prefix length for networks in the network area.
- `id` (String) Terraform's internal resource ID. It is structured as "`organization_id`,`network_area_id`".
- `max_prefix_length` (Number) The maximal prefix length for networks in the network area.
- `min_prefix_length` (Number) The minimal prefix length for networks in the network area.
- `name` (String) The name of the network area.
- `network_ranges` (Attributes List) List of Network ranges. (see [below for nested schema](#nestedatt--network_ranges))
- `project_count` (Number) The amount of projects currently referencing this area.
- `transfer_network` (String) Classless Inter-Domain Routing (CIDR).
<a id="nestedatt--network_ranges"></a>
### Nested Schema for `network_ranges`
Read-Only:
- `network_range_id` (String)
- `prefix` (String)

View file

@ -0,0 +1,39 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_network_area_route Data Source - stackit"
subcategory: ""
description: |-
Network area route data source schema. Must have a region specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
---
# stackit_network_area_route (Data Source)
Network area route data source schema. Must have a `region` specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
## Example Usage
```terraform
data "stackit_network_area_route" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_route_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `network_area_id` (String) The network area ID to which the network area route is associated.
- `network_area_route_id` (String) The network area route ID.
- `organization_id` (String) STACKIT organization ID to which the network area is associated.
### Read-Only
- `id` (String) Terraform's internal data source ID. It is structured as "`organization_id`,`network_area_id`,`network_area_route_id`".
- `next_hop` (String) The IP address of the routing system, that will route the prefix configured. Should be a valid IPv4 address.
- `prefix` (String) The network, that is reachable though the Next Hop. Should use CIDR notation.

View file

@ -37,8 +37,11 @@ export STACKIT_TF_ENABLE_BETA_RESOURCES=true
## Listing Beta Resources
- [`stackit_server_backup_schedule`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/resources/server_backup_schedule)
- [`stackit_network_area`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/resources/network_area)
- [`stackit_network_area_route`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/resources/network_area_route)
## Listing Beta Data Sources
- [`stackit_server_backup_schedule`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/data-sources/server_backup_schedule)
- [`stackit_server_backup_schedules`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/data-sources/server_backup_schedules)
- [`stackit_server_backup_schedules`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/data-sources/server_backup_schedules)
- [`stackit_network_area_route`](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/data-sources/network_area_route)

View file

@ -0,0 +1,62 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_network_area Resource - stackit"
subcategory: ""
description: |-
Network area resource schema. Must have a region specified in the provider configuration.
---
# stackit_network_area (Resource)
Network area resource schema. Must have a `region` specified in the provider configuration.
## Example Usage
```terraform
resource "stackit_network_area" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network-area"
network_ranges = [
{
prefix = "1.2.3.4"
}
]
transfer_network = "1.2.3.4/5"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `name` (String) The name of the network area.
- `network_ranges` (Attributes List) List of Network ranges. (see [below for nested schema](#nestedatt--network_ranges))
- `organization_id` (String) STACKIT organization ID to which the network area is associated.
- `transfer_network` (String) Classless Inter-Domain Routing (CIDR).
### Optional
- `default_nameservers` (List of String) List of DNS Servers/Nameservers.
- `default_prefix_length` (Number) The default prefix length for networks in the network area.
- `max_prefix_length` (Number) The maximal prefix length for networks in the network area.
- `min_prefix_length` (Number) The minimal prefix length for networks in the network area.
### Read-Only
- `id` (String) Network area resource schema. Must have a `region` specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
- `network_area_id` (String) The network area ID.
- `project_count` (Number) The amount of projects currently referencing this area.
<a id="nestedatt--network_ranges"></a>
### Nested Schema for `network_ranges`
Required:
- `prefix` (String) Classless Inter-Domain Routing (CIDR).
Read-Only:
- `network_range_id` (String)

View file

@ -0,0 +1,39 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_network_area_route Resource - stackit"
subcategory: ""
description: |-
Network area route resource schema. Must have a region specified in the provider configuration.
---
# stackit_network_area_route (Resource)
Network area route resource schema. Must have a `region` specified in the provider configuration.
## Example Usage
```terraform
resource "stackit_network_area" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
prefix = "1.2.3.4/5"
next_hop = "6.7.8.9"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `network_area_id` (String) The network area ID to which the network area route is associated.
- `next_hop` (String) The IP address of the routing system, that will route the prefix configured. Should be a valid IPv4 address.
- `organization_id` (String) STACKIT organization ID to which the network area is associated.
- `prefix` (String) The network, that is reachable though the Next Hop. Should use CIDR notation.
### Read-Only
- `id` (String) Network area route resource schema. Must have a `region` specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
- `network_area_route_id` (String) The network area route ID.