Skip to content

Commit

Permalink
Onboard public_ip_associate resource (#582)
Browse files Browse the repository at this point in the history
* onboard public_ip_associate resource

* add warnings

* add example

* edit warning message

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

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

Co-authored-by: João Palet <[email protected]>

* add requiresReplace in network_interface_id

* change function name to toCreatePayload

* change deletion of the public ip association

* add unit test

* Add missing space between sentences

* update conflict warning message

* update conflict warning message

* Adjust warning message

---------

Co-authored-by: João Palet <[email protected]>
Co-authored-by: João Palet <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2024
1 parent 7b693ac commit 2a2d62a
Show file tree
Hide file tree
Showing 5 changed files with 545 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/resources/public_ip_associate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
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 network interface, as they both have control of the network interface association and this will lead to conflicts.
~> 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 network interface, as they both have control of the network interface association and this will lead to conflicts.

~> 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
resource "stackit_public_ip_associate" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
public_ip_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_interface_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

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

### Required

- `network_interface_id` (String) The ID of the network interface (or virtual IP) to which the public IP should be attached to.
- `project_id` (String) STACKIT project ID to which the public IP is associated.
- `public_ip_id` (String) The public IP ID.

### Read-Only

- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`public_ip_id`,`network_interface_id`".
- `ip` (String) The IP address.
5 changes: 5 additions & 0 deletions examples/resources/stackit_public_ip_associate/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "stackit_public_ip_associate" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
public_ip_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_interface_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Loading

0 comments on commit 2a2d62a

Please sign in to comment.