Skip to content

Commit

Permalink
feat: Add examples and generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopalet committed Nov 26, 2024
1 parent 3ca6773 commit f4a244e
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 4 deletions.
40 changes: 40 additions & 0 deletions docs/data-sources/virtual_ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_virtual_ip Data Source - stackit"
subcategory: ""
description: |-
Virtual IP 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_virtual_ip (Data Source)

Virtual IP 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_virtual_ip" "virtual_ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
virtual_ip_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

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

### Required

- `network_id` (String) The network area ID to which the virtual IP is associated.
- `project_id` (String) STACKIT organization ID to which the network area is associated.
- `virtual_ip_id` (String) The virtual IP ID.

### Read-Only

- `id` (String) Terraform's internal data source ID. It is structured as "`project_id`,`network_id`,`virtual_ip_id`".
- `ip` (String) The IP address of the virtual IP.
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
- `name` (String) The name of virtual IP.
6 changes: 2 additions & 4 deletions docs/resources/public_ip_associate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ page_title: "stackit_public_ip_associate Resource - stackit"
subcategory: ""
description: |-
Associates an existing public IP to a network interface. This is useful for situations where you have a pre-allocated public IP or unable to use the stackit_public_ip resource to create a new public IP. Must have a region specified in the provider configuration.
!> The stackit_public_ip_associate resource should not be used together with the stackit_public_ip resource for the same public IP or for the same network interface.
Using both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association.
!> The "stackitpublicipassociate" resource should not be used together with the "stackitpublic_ip" resource for the same public IP or for the same network interface. \nUsing both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association.
~> 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_public_ip_associate (Resource)

Associates an existing public IP to a network interface. This is useful for situations where you have a pre-allocated public IP or unable to use the `stackit_public_ip` resource to create a new public IP. Must have a `region` specified in the provider configuration.

!> The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same public IP or for the same network interface.
Using both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association.
!> The "stackit_public_ip_associate" resource should not be used together with the "stackit_public_ip" resource for the same public IP or for the same network interface. \nUsing both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association.

~> 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.

Expand Down
53 changes: 53 additions & 0 deletions docs/resources/virtual_ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_virtual_ip Resource - stackit"
subcategory: ""
description: |-
Virtual IP 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.
---

# stackit_virtual_ip (Resource)

Virtual IP 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.

## Example Usage

```terraform
// Create a network
resource "stackit_network" "network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network"
}
// Create a virtual IP on the network
resource "stackit_virtual_ip" "virtual_ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
name = "example-virtual-ip"
labels = {
"key" = "value"
}
}
```

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

### Required

- `network_id` (String) The network ID to which the virtual IP is associated.
- `project_id` (String) STACKIT project ID to which the virtual IP is associated.

### Optional

- `ip` (String) The IP address of the virtual IP.
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
- `name` (String) The name of virtual IP.

### Read-Only

- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`network_id`,`virtual_ip_id`".
- `virtual_ip_id` (String) The virtual IP ID.
63 changes: 63 additions & 0 deletions docs/resources/virtual_ip_member.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_virtual_ip_member Resource - stackit"
subcategory: ""
description: |-
Virtual IP member resource schema. This resource allows you to add a network interface as a member of a virtual IP. 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_virtual_ip_member (Resource)

Virtual IP member resource schema. This resource allows you to add a network interface as a member of a virtual IP. 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
// Create a network
resource "stackit_network" "network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network"
}
// Create a network interface
resource "stackit_network_interface" "network_interface" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
name = "example-network-interface"
}
// Create a virtual IP on the network
resource "stackit_virtual_ip" "virtual_ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
name = "example-virtual-ip"
labels = {
"key" = "value"
}
}
// Add a network interface as a member of the virtual IP
resource "stackit_virtual_ip_member" "virtual_ip_member" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
virtual_ip_id = stackit_virtual_ip.vip.virtual_ip_id
network_interface_id = stackit_network_interface.nic_1.network_interface_id
}
```

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

### Required

- `network_id` (String) The network ID to which the virtual IP is associated.
- `network_interface_id` (String) The ID of the network interface to add as a member of the virtual IP.
- `project_id` (String) STACKIT project ID to which the virtual IP is associated.
- `virtual_ip_id` (String) The virtual IP ID.

### Read-Only

- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`network_id`,`virtual_ip_id`".
5 changes: 5 additions & 0 deletions examples/data-sources/stackit_virtual_ip/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data "stackit_virtual_ip" "virtual_ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
virtual_ip_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
15 changes: 15 additions & 0 deletions examples/resources/stackit_virtual_ip/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Create a network
resource "stackit_network" "network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network"
}

// Create a virtual IP on the network
resource "stackit_virtual_ip" "virtual_ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
name = "example-virtual-ip"
labels = {
"key" = "value"
}
}
30 changes: 30 additions & 0 deletions examples/resources/stackit_virtual_ip_member/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Create a network
resource "stackit_network" "network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network"
}

// Create a network interface
resource "stackit_network_interface" "network_interface" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
name = "example-network-interface"
}

// Create a virtual IP on the network
resource "stackit_virtual_ip" "virtual_ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
name = "example-virtual-ip"
labels = {
"key" = "value"
}
}

// Add a network interface as a member of the virtual IP
resource "stackit_virtual_ip_member" "virtual_ip_member" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.network.network_id
virtual_ip_id = stackit_virtual_ip.vip.virtual_ip_id
network_interface_id = stackit_network_interface.nic_1.network_interface_id
}

0 comments on commit f4a244e

Please sign in to comment.