Implement new stackit_network resource and datasource (#366)

* Copy file from DNS zone resource

* Implement resource

* Implement datasource

* Add examples

* Implement acceptance test; Some fixes

* Add docs

* Fix linter

* Fixes after review
This commit is contained in:
João Palet 2024-05-20 17:17:39 +01:00 committed by GitHub
parent 940b15e4b8
commit 76b8e5692d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 1216 additions and 4 deletions

View file

@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_network Data Source - stackit"
subcategory: ""
description: |-
Network resource schema. Must have a region specified in the provider configuration.
---
# stackit_network (Data Source)
Network resource schema. Must have a `region` specified in the provider configuration.
## Example Usage
```terraform
data "stackit_network" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `network_id` (String) The network ID.
- `project_id` (String) STACKIT project ID to which the network is associated.
### Read-Only
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`network_id`".
- `ipv4_prefix_length` (Number) The IPv4 prefix length of the network.
- `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.
- `public_ip` (String) The public IP of the network.

View file

@ -143,6 +143,7 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de
- `argus_custom_endpoint` (String) Custom endpoint for the Argus service
- `credentials_path` (String) Path of JSON from where the credentials are read. Takes precedence over the env var `STACKIT_CREDENTIALS_PATH`. Default value is `~/.stackit/credentials.json`.
- `dns_custom_endpoint` (String) Custom endpoint for the DNS service
- `iaas_custom_endpoint` (String) Custom endpoint for the IaaS service
- `jwks_custom_endpoint` (String, Deprecated) Custom endpoint for the jwks API, which is used to get the json web key sets (jwks) to validate tokens when using the key flow
- `loadbalancer_custom_endpoint` (String) Custom endpoint for the Load Balancer service
- `logme_custom_endpoint` (String) Custom endpoint for the LogMe service
@ -155,7 +156,7 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de
- `private_key` (String) Private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key.
- `private_key_path` (String) Path for the private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key.
- `rabbitmq_custom_endpoint` (String) Custom endpoint for the RabbitMQ service
- `redis_custom_endpoint` (String)
- `redis_custom_endpoint` (String) Custom endpoint for the Redis service
- `region` (String) Region will be used as the default location for regional services. Not all services require a region, some are global
- `resourcemanager_custom_endpoint` (String) Custom endpoint for the Resource Manager service
- `secretsmanager_custom_endpoint` (String) Custom endpoint for the Secrets Manager service

42
docs/resources/network.md Normal file
View file

@ -0,0 +1,42 @@
---
# 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.
---
# stackit_network (Resource)
Network resource schema. Must have a `region` specified in the provider configuration.
## 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
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `name` (String) The name of the network.
- `nameservers` (List of String) The nameservers of the network.
- `project_id` (String) STACKIT project ID to which the network is associated.
### Optional
- `ipv4_prefix_length` (Number) The IPv4 prefix length of the network.
### Read-Only
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`network_id`".
- `network_id` (String) The network ID.
- `prefixes` (List of String) The prefixes of the network.
- `public_ip` (String) The public IP of the network.