chore(iaas): move beta resources and datasources to GA (#717)
relates to STACKITTPR-103
This commit is contained in:
parent
176fb8408f
commit
727d67af01
59 changed files with 80 additions and 518 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -31,3 +31,6 @@ vendor/
|
||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
go.work.sum
|
go.work.sum
|
||||||
|
|
||||||
|
# Unit test files
|
||||||
|
stackit/internal/services/iaas/test-512k.img
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_image Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Image datasource schema. Must have a region specified in the provider configuration.
|
Image 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_image (Data Source)
|
# stackit_image (Data Source)
|
||||||
|
|
||||||
Image datasource schema. Must have a `region` specified in the provider configuration.
|
Image 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_key_pair Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Key pair resource schema. Must have a region specified in the provider configuration.
|
Key pair 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_key_pair (Data Source)
|
# stackit_key_pair (Data Source)
|
||||||
|
|
||||||
Key pair resource schema. Must have a `region` specified in the provider configuration.
|
Key pair 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_network_area Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network area datasource schema. Must have a region specified in the provider configuration.
|
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)
|
# stackit_network_area (Data Source)
|
||||||
|
|
||||||
Network area datasource schema. Must have a `region` specified in the provider configuration.
|
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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,12 @@
|
||||||
page_title: "stackit_network_area_route Data Source - stackit"
|
page_title: "stackit_network_area_route Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network area route data source schema. Must have a region specified in the provider configuration.
|
Network area route data 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_network_area_route (Data Source)
|
# stackit_network_area_route (Data Source)
|
||||||
|
|
||||||
Network area route data source schema. Must have a `region` specified in the provider configuration.
|
Network area route data 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
|
## Example Usage
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_network_interface Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network interface datasource schema. Must have a region specified in the provider configuration.
|
Network interface 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_interface (Data Source)
|
# stackit_network_interface (Data Source)
|
||||||
|
|
||||||
Network interface datasource schema. Must have a `region` specified in the provider configuration.
|
Network interface 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_public_ip Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Public IP resource schema. Must have a region specified in the provider configuration.
|
Public 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_public_ip (Data Source)
|
# stackit_public_ip (Data Source)
|
||||||
|
|
||||||
Public IP resource schema. Must have a `region` specified in the provider configuration.
|
Public 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_public_ip_ranges Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
A list of all public IP ranges that STACKIT uses.
|
A list of all public IP ranges that STACKIT uses.
|
||||||
~> 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_ranges (Data Source)
|
# stackit_public_ip_ranges (Data Source)
|
||||||
|
|
||||||
A list of all public IP ranges that STACKIT uses.
|
A list of all public IP ranges that STACKIT uses.
|
||||||
|
|
||||||
~> 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_security_group Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Security group datasource schema. Must have a region specified in the provider configuration.
|
Security group 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_security_group (Data Source)
|
# stackit_security_group (Data Source)
|
||||||
|
|
||||||
Security group datasource schema. Must have a `region` specified in the provider configuration.
|
Security group 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_security_group_rule Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Security group datasource schema. Must have a region specified in the provider configuration.
|
Security group 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_security_group_rule (Data Source)
|
# stackit_security_group_rule (Data Source)
|
||||||
|
|
||||||
Security group datasource schema. Must have a `region` specified in the provider configuration.
|
Security group 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_server Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Server datasource schema. Must have a region specified in the provider configuration.
|
Server 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_server (Data Source)
|
# stackit_server (Data Source)
|
||||||
|
|
||||||
Server datasource schema. Must have a `region` specified in the provider configuration.
|
Server 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_volume Data Source - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Volume resource schema. Must have a region specified in the provider configuration.
|
Volume 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_volume (Data Source)
|
# stackit_volume (Data Source)
|
||||||
|
|
||||||
Volume resource schema. Must have a `region` specified in the provider configuration.
|
Volume 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ description: |-
|
||||||
on the same compute node if possible, but if not possible they still will be scheduled instead of failure.
|
on the same compute node if possible, but if not possible they still will be scheduled instead of failure.
|
||||||
soft-anti-affinity- All servers launched in this group will be hosted on different compute nodes if possible,
|
soft-anti-affinity- All servers launched in this group will be hosted on different compute nodes if possible,
|
||||||
but if not possible they still will be scheduled instead of failure.
|
but if not possible they still will be scheduled instead of failure.
|
||||||
~> 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_affinity_group (Resource)
|
# stackit_affinity_group (Resource)
|
||||||
|
|
@ -80,9 +79,6 @@ resource "stackit_server" "example-server" {
|
||||||
* `soft-anti-affinity`- All servers launched in this group will be hosted on different compute nodes if possible,
|
* `soft-anti-affinity`- All servers launched in this group will be hosted on different compute nodes if possible,
|
||||||
but if not possible they still will be scheduled instead of failure.
|
but if not possible they still will be scheduled instead of failure.
|
||||||
|
|
||||||
|
|
||||||
~> 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@ description: |-
|
||||||
machine_type = "g1.1"
|
machine_type = "g1.1"
|
||||||
keypair_name = "example-key-pair"
|
keypair_name = "example-key-pair"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
~> 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_key_pair (Resource)
|
# stackit_key_pair (Resource)
|
||||||
|
|
@ -56,8 +53,6 @@ resource "stackit_server" "example-server" {
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
~> 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_network_area Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network area resource schema. Must have a region specified in the provider configuration.
|
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.
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# stackit_network_area (Resource)
|
# stackit_network_area (Resource)
|
||||||
|
|
||||||
Network area resource schema. Must have a `region` specified in the provider configuration.
|
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.
|
|
||||||
|
|
||||||
## Example Usage
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_network_area_route Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network area route resource schema. Must have a region specified in the provider configuration.
|
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.
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# stackit_network_area_route (Resource)
|
# stackit_network_area_route (Resource)
|
||||||
|
|
||||||
Network area route resource schema. Must have a `region` specified in the provider configuration.
|
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.
|
|
||||||
|
|
||||||
## Example Usage
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_network_interface Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network interface resource schema. Must have a region specified in the provider configuration.
|
Network interface 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_network_interface (Resource)
|
# stackit_network_interface (Resource)
|
||||||
|
|
||||||
Network interface resource schema. Must have a `region` specified in the provider configuration.
|
Network interface 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_public_ip Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Public IP resource schema. Must have a region specified in the provider configuration.
|
Public 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_public_ip (Resource)
|
# stackit_public_ip (Resource)
|
||||||
|
|
||||||
Public IP resource schema. Must have a `region` specified in the provider configuration.
|
Public 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ 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.
|
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.
|
!> 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.
|
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.
|
||||||
~> 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)
|
# stackit_public_ip_associate (Resource)
|
||||||
|
|
@ -16,8 +15,6 @@ Associates an existing public IP to a network interface. This is useful for situ
|
||||||
!> 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.
|
!> 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.
|
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.
|
||||||
|
|
||||||
~> 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_security_group Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Security group resource schema. Must have a region specified in the provider configuration.
|
Security group 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_security_group (Resource)
|
# stackit_security_group (Resource)
|
||||||
|
|
||||||
Security group resource schema. Must have a `region` specified in the provider configuration.
|
Security group 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_security_group_rule Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Security group rule resource schema. Must have a region specified in the provider configuration.
|
Security group rule 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_security_group_rule (Resource)
|
# stackit_security_group_rule (Resource)
|
||||||
|
|
||||||
Security group rule resource schema. Must have a `region` specified in the provider configuration.
|
Security group rule 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ page_title: "stackit_server Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Server resource schema. Must have a region specified in the provider configuration.
|
Server 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
|
Example Usage
|
||||||
With key pair
|
With key pair
|
||||||
|
|
||||||
|
|
@ -184,7 +183,6 @@ description: |-
|
||||||
|
|
||||||
Server resource schema. Must have a region specified in the provider configuration.
|
Server 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
|
## Example Usage
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_server_network_interface_attach Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Network interface attachment resource schema. Attaches a network interface to a server. Must have a region specified in the provider configuration. The attachment only takes full effect after server reboot.
|
Network interface attachment resource schema. Attaches a network interface to a server. Must have a region specified in the provider configuration. The attachment only takes full effect after server reboot.
|
||||||
~> 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_server_network_interface_attach (Resource)
|
# stackit_server_network_interface_attach (Resource)
|
||||||
|
|
||||||
Network interface attachment resource schema. Attaches a network interface to a server. Must have a `region` specified in the provider configuration. The attachment only takes full effect after server reboot.
|
Network interface attachment resource schema. Attaches a network interface to a server. Must have a `region` specified in the provider configuration. The attachment only takes full effect after server reboot.
|
||||||
|
|
||||||
~> 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_server_service_account_attach Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Service account attachment resource schema. Attaches a service account to a server. Must have a region specified in the provider configuration.
|
Service account attachment resource schema. Attaches a service account to a server. 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_server_service_account_attach (Resource)
|
# stackit_server_service_account_attach (Resource)
|
||||||
|
|
||||||
Service account attachment resource schema. Attaches a service account to a server. Must have a `region` specified in the provider configuration.
|
Service account attachment resource schema. Attaches a service account to a server. 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_server_volume_attach Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Volume attachment resource schema. Attaches a volume to a server. Must have a region specified in the provider configuration.
|
Volume attachment resource schema. Attaches a volume to a server. 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_server_volume_attach (Resource)
|
# stackit_server_volume_attach (Resource)
|
||||||
|
|
||||||
Volume attachment resource schema. Attaches a volume to a server. Must have a `region` specified in the provider configuration.
|
Volume attachment resource schema. Attaches a volume to a server. 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@ page_title: "stackit_volume Resource - stackit"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Volume resource schema. Must have a region specified in the provider configuration.
|
Volume 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_volume (Resource)
|
# stackit_volume (Resource)
|
||||||
|
|
||||||
Volume resource schema. Must have a `region` specified in the provider configuration.
|
Volume 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
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -14,7 +14,7 @@ require (
|
||||||
github.com/stackitcloud/stackit-sdk-go/core v0.16.0
|
github.com/stackitcloud/stackit-sdk-go/core v0.16.0
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.11.0
|
github.com/stackitcloud/stackit-sdk-go/services/argus v0.11.0
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.13.0
|
github.com/stackitcloud/stackit-sdk-go/services/dns v0.13.0
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.21.1
|
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.22.0
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.0.0
|
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.0.0
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.21.0
|
github.com/stackitcloud/stackit-sdk-go/services/logme v0.21.0
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.21.0
|
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.21.0
|
||||||
|
|
|
||||||
6
go.sum
6
go.sum
|
|
@ -159,10 +159,8 @@ github.com/stackitcloud/stackit-sdk-go/services/authorization v0.6.0 h1:nSaSvo9o
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.6.0/go.mod h1:LoOkWrUropfVm72oE5aWSC9yRiM3s8Vf3TvC7HtC3b8=
|
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.6.0/go.mod h1:LoOkWrUropfVm72oE5aWSC9yRiM3s8Vf3TvC7HtC3b8=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.13.0 h1:gEoA2oj3OcDg3XI0KSJm8mCjQz9WOZENeSgfTFPK8ow=
|
github.com/stackitcloud/stackit-sdk-go/services/dns v0.13.0 h1:gEoA2oj3OcDg3XI0KSJm8mCjQz9WOZENeSgfTFPK8ow=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.13.0/go.mod h1:JE8POcTfSxTo+g1MkgVQ+OjT4jWEr08MIY8qx3Hi+Tw=
|
github.com/stackitcloud/stackit-sdk-go/services/dns v0.13.0/go.mod h1:JE8POcTfSxTo+g1MkgVQ+OjT4jWEr08MIY8qx3Hi+Tw=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.21.1 h1:ZFFJr54FcYTUBjE+5E3Cx92jTDdHGKT2DTIvvJSRrTc=
|
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.22.0 h1:xaNory8kBIsBG7PJnBfPP1cERc+ERqjebxmEmEOvRHU=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.21.1/go.mod h1:9p5IIdOKOM5/DIjbenKrWvz6GlSps4jsPJZkH7QJuRU=
|
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.22.0/go.mod h1:LVOYlzNt5BXDC42AHd/GZj6KvlCg4w94of/E6pZOj5k=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.18.0 h1:7nNjIIcBQRDVnW4NL7+R8DaCKEqxxxsmVsgOVe50ZMU=
|
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.18.0/go.mod h1:UFujBT+JlNvl6JNrY96UpLGqp+lZTD+JWL7siqhGPlw=
|
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.0.0 h1:z2p0OobEAgSE5bQr+KR+4Y1QTvDbSC2a7w2eCV/oSp4=
|
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.0.0 h1:z2p0OobEAgSE5bQr+KR+4Y1QTvDbSC2a7w2eCV/oSp4=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.0.0/go.mod h1:x0jgrL+/K2cE4BvcIQByFUf0nOPVZRqq5Z074kjjr64=
|
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.0.0/go.mod h1:x0jgrL+/K2cE4BvcIQByFUf0nOPVZRqq5Z074kjjr64=
|
||||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.21.0 h1:P7bxaVzkZPGMWItLynKIvc88Xh6jCnK4dPTTT+L607o=
|
github.com/stackitcloud/stackit-sdk-go/services/logme v0.21.0 h1:P7bxaVzkZPGMWItLynKIvc88Xh6jCnK4dPTTT+L607o=
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
||||||
|
|
@ -22,8 +21,6 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
)
|
)
|
||||||
|
|
||||||
var affinityGroupDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &affinityGroupDatasource{}
|
_ datasource.DataSource = &affinityGroupDatasource{}
|
||||||
_ datasource.DataSourceWithConfigure = &affinityGroupDatasource{}
|
_ datasource.DataSourceWithConfigure = &affinityGroupDatasource{}
|
||||||
|
|
@ -49,14 +46,6 @@ func (d *affinityGroupDatasource) Configure(ctx context.Context, req datasource.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !affinityGroupDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_affinity_group", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
affinityGroupDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
||||||
|
|
@ -27,11 +26,6 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
)
|
)
|
||||||
|
|
||||||
// affinityGroupResourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var affinityGroupResourceBetaCheckDone bool
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &affinityGroupResource{}
|
_ resource.Resource = &affinityGroupResource{}
|
||||||
_ resource.ResourceWithConfigure = &affinityGroupResource{}
|
_ resource.ResourceWithConfigure = &affinityGroupResource{}
|
||||||
|
|
@ -75,14 +69,6 @@ func (r *affinityGroupResource) Configure(ctx context.Context, req resource.Conf
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !affinityGroupResourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_affinity_group", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
affinityGroupResourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -111,7 +97,7 @@ func (r *affinityGroupResource) Schema(_ context.Context, _ resource.SchemaReque
|
||||||
description := "Affinity Group schema. Must have a `region` specified in the provider configuration."
|
description := "Affinity Group schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: description,
|
Description: description,
|
||||||
MarkdownDescription: features.AddBetaDescription(description + "\n\n" + exampleUsageWithServer + policies),
|
MarkdownDescription: description + "\n\n" + exampleUsageWithServer + policies,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource identifier. It is structured as \"`project_id`,`affinity_group_id`\".",
|
Description: "Terraform's internal resource identifier. It is structured as \"`project_id`,`affinity_group_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// imageDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var imageDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &imageDataSource{}
|
_ datasource.DataSource = &imageDataSource{}
|
||||||
|
|
@ -77,14 +71,6 @@ func (d *imageDataSource) Configure(ctx context.Context, req datasource.Configur
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !imageDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_image", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
imageDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -107,9 +93,10 @@ func (d *imageDataSource) Configure(ctx context.Context, req datasource.Configur
|
||||||
|
|
||||||
// Schema defines the schema for the datasource.
|
// Schema defines the schema for the datasource.
|
||||||
func (r *imageDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (r *imageDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Image datasource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Image datasource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Image datasource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`image_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`image_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &imageResource{}
|
_ resource.Resource = &imageResource{}
|
||||||
|
|
@ -134,14 +128,6 @@ func (r *imageResource) Configure(ctx context.Context, req resource.ConfigureReq
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_image", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,8 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// keyPairDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var keyPairDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &keyPairDataSource{}
|
_ datasource.DataSource = &keyPairDataSource{}
|
||||||
|
|
@ -57,14 +51,6 @@ func (d *keyPairDataSource) Configure(ctx context.Context, req datasource.Config
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !keyPairDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_key_pair", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
keyPairDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -90,7 +76,7 @@ func (r *keyPairDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
|
||||||
description := "Key pair resource schema. Must have a `region` specified in the provider configuration."
|
description := "Key pair resource schema. Must have a `region` specified in the provider configuration."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription(description),
|
MarkdownDescription: description,
|
||||||
Description: description,
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,8 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &keyPairResource{}
|
_ resource.Resource = &keyPairResource{}
|
||||||
|
|
@ -70,14 +64,6 @@ func (r *keyPairResource) Configure(ctx context.Context, req resource.ConfigureR
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_key_pair", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -107,7 +93,7 @@ func (r *keyPairResource) Schema(_ context.Context, _ resource.SchemaRequest, re
|
||||||
description := "Key pair resource schema. Must have a `region` specified in the provider configuration. Allows uploading an SSH public key to be used for server authentication."
|
description := "Key pair resource schema. Must have a `region` specified in the provider configuration. Allows uploading an SSH public key to be used for server authentication."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription(description + "\n\n" + exampleUsageWithServer),
|
MarkdownDescription: description + "\n\n" + exampleUsageWithServer,
|
||||||
Description: description,
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// scheduleDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var networkAreaDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &networkAreaDataSource{}
|
_ datasource.DataSource = &networkAreaDataSource{}
|
||||||
|
|
@ -61,14 +55,6 @@ func (d *networkAreaDataSource) Configure(ctx context.Context, req datasource.Co
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !networkAreaDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_network_area", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
networkAreaDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -91,9 +77,10 @@ func (d *networkAreaDataSource) Configure(ctx context.Context, req datasource.Co
|
||||||
|
|
||||||
// Schema defines the schema for the data source.
|
// Schema defines the schema for the data source.
|
||||||
func (d *networkAreaDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (d *networkAreaDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Network area datasource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: "Network area resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
MarkdownDescription: features.AddBetaDescription("Network area datasource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`organization_id`,`network_area_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`organization_id`,`network_area_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
internalUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
internalUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &networkAreaResource{}
|
_ resource.Resource = &networkAreaResource{}
|
||||||
|
|
@ -99,14 +93,6 @@ func (r *networkAreaResource) Configure(ctx context.Context, req resource.Config
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_network_area", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -133,9 +119,10 @@ func (r *networkAreaResource) Configure(ctx context.Context, req resource.Config
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *networkAreaResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *networkAreaResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Network area resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: "Network area resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
MarkdownDescription: features.AddBetaDescription("Network area resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`organization_id`,`network_area_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`organization_id`,`network_area_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -963,14 +963,14 @@ func TestUpdateNetworkRanges(t *testing.T) {
|
||||||
|
|
||||||
// Setup server and client
|
// Setup server and client
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
router.HandleFunc("/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges", func(w http.ResponseWriter, r *http.Request) {
|
router.HandleFunc("/v1/organizations/{organizationId}/network-areas/{areaId}/network-ranges", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method == "GET" {
|
if r.Method == "GET" {
|
||||||
getAllNetworkRangesHandler(w, r)
|
getAllNetworkRangesHandler(w, r)
|
||||||
} else if r.Method == "POST" {
|
} else if r.Method == "POST" {
|
||||||
createNetworkRangeHandler(w, r)
|
createNetworkRangeHandler(w, r)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
router.HandleFunc("/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}", deleteNetworkRangeHandler)
|
router.HandleFunc("/v1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}", deleteNetworkRangeHandler)
|
||||||
mockedServer := httptest.NewServer(router)
|
mockedServer := httptest.NewServer(router)
|
||||||
defer mockedServer.Close()
|
defer mockedServer.Close()
|
||||||
client, err := iaas.NewAPIClient(
|
client, err := iaas.NewAPIClient(
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// scheduleDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var networkAreaRouteDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &networkAreaRouteDataSource{}
|
_ datasource.DataSource = &networkAreaRouteDataSource{}
|
||||||
|
|
@ -58,14 +52,6 @@ func (d *networkAreaRouteDataSource) Configure(ctx context.Context, req datasour
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !networkAreaRouteDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_network_area_route", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
networkAreaRouteDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -88,9 +74,10 @@ func (d *networkAreaRouteDataSource) Configure(ctx context.Context, req datasour
|
||||||
|
|
||||||
// Schema defines the schema for the data source.
|
// Schema defines the schema for the data source.
|
||||||
func (d *networkAreaRouteDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (d *networkAreaRouteDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Network area route data resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: "Network area route data resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
MarkdownDescription: features.AddBetaDescription("Network area route data source schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal data source ID. It is structured as \"`organization_id`,`network_area_id`,`network_area_route_id`\".",
|
Description: "Terraform's internal data source ID. It is structured as \"`organization_id`,`network_area_id`,`network_area_route_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &networkAreaRouteResource{}
|
_ resource.Resource = &networkAreaRouteResource{}
|
||||||
|
|
@ -74,14 +68,6 @@ func (r *networkAreaRouteResource) Configure(ctx context.Context, req resource.C
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_network_area_route", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -108,9 +94,10 @@ func (r *networkAreaRouteResource) Configure(ctx context.Context, req resource.C
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *networkAreaRouteResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *networkAreaRouteResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Network area route resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: "Network area route resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
MarkdownDescription: features.AddBetaDescription("Network area route resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`organization_id`,`network_area_id`,`network_area_route_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`organization_id`,`network_area_id`,`network_area_route_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// scheduleDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var networkInterfaceDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &networkInterfaceDataSource{}
|
_ datasource.DataSource = &networkInterfaceDataSource{}
|
||||||
|
|
@ -59,14 +53,6 @@ func (d *networkInterfaceDataSource) Configure(ctx context.Context, req datasour
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !networkInterfaceDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_network_interface", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
networkInterfaceDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -90,10 +76,11 @@ func (d *networkInterfaceDataSource) Configure(ctx context.Context, req datasour
|
||||||
// Schema defines the schema for the data source.
|
// Schema defines the schema for the data source.
|
||||||
func (d *networkInterfaceDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (d *networkInterfaceDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
typeOptions := []string{"server", "metadata", "gateway"}
|
typeOptions := []string{"server", "metadata", "gateway"}
|
||||||
|
description := "Network interface datasource schema. Must have a `region` specified in the provider configuration."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Network interface datasource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Network interface datasource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal data source ID. It is structured as \"`project_id`,`network_id`,`network_interface_id`\".",
|
Description: "Terraform's internal data source ID. It is structured as \"`project_id`,`network_id`,`network_interface_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &networkInterfaceResource{}
|
_ resource.Resource = &networkInterfaceResource{}
|
||||||
|
|
@ -84,14 +78,6 @@ func (r *networkInterfaceResource) Configure(ctx context.Context, req resource.C
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_network_interface", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -119,10 +105,11 @@ func (r *networkInterfaceResource) Configure(ctx context.Context, req resource.C
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *networkInterfaceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *networkInterfaceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
typeOptions := []string{"server", "metadata", "gateway"}
|
typeOptions := []string{"server", "metadata", "gateway"}
|
||||||
|
description := "Network interface resource schema. Must have a `region` specified in the provider configuration."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Network interface resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Network interface resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`network_id`,`network_interface_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`network_id`,`network_interface_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &networkInterfaceAttachResource{}
|
_ resource.Resource = &networkInterfaceAttachResource{}
|
||||||
|
|
@ -69,14 +63,6 @@ func (r *networkInterfaceAttachResource) Configure(ctx context.Context, req reso
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_server_network_interface_attach", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -103,9 +89,10 @@ func (r *networkInterfaceAttachResource) Configure(ctx context.Context, req reso
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *networkInterfaceAttachResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *networkInterfaceAttachResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Network interface attachment resource schema. Attaches a network interface to a server. Must have a `region` specified in the provider configuration. The attachment only takes full effect after server reboot."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Network interface attachment resource schema. Attaches a network interface to a server. Must have a `region` specified in the provider configuration. The attachment only takes full effect after server reboot."),
|
MarkdownDescription: description,
|
||||||
Description: "Network interface attachment resource schema. Attaches a network interface to a server. Must have a `region` specified in the provider configuration. The attachment only takes full effect after server reboot.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`,`network_interface_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`,`network_interface_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// publicIpDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var publicIpDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &publicIpDataSource{}
|
_ datasource.DataSource = &publicIpDataSource{}
|
||||||
|
|
@ -58,14 +52,6 @@ func (d *publicIpDataSource) Configure(ctx context.Context, req datasource.Confi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !publicIpDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_public_ip", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
publicIpDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -88,9 +74,10 @@ func (d *publicIpDataSource) Configure(ctx context.Context, req datasource.Confi
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *publicIpDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (r *publicIpDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Public IP resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Public IP resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Public IP resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal datasource ID. It is structured as \"`project_id`,`public_ip_id`\".",
|
Description: "Terraform's internal datasource ID. It is structured as \"`project_id`,`public_ip_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &publicIpResource{}
|
_ resource.Resource = &publicIpResource{}
|
||||||
|
|
@ -73,14 +67,6 @@ func (r *publicIpResource) Configure(ctx context.Context, req resource.Configure
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_public_ip", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -107,9 +93,10 @@ func (r *publicIpResource) Configure(ctx context.Context, req resource.Configure
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *publicIpResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *publicIpResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Public IP resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Public IP resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Public IP resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`public_ip_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`public_ip_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &publicIpAssociateResource{}
|
_ resource.Resource = &publicIpAssociateResource{}
|
||||||
|
|
@ -71,14 +65,6 @@ func (r *publicIpAssociateResource) Configure(ctx context.Context, req resource.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_public_ip_associate", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -116,7 +102,7 @@ func (r *publicIpAssociateResource) Schema(_ context.Context, _ resource.SchemaR
|
||||||
"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.",
|
"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.",
|
||||||
}
|
}
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription(fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["warning_message"])),
|
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["warning_message"]),
|
||||||
Description: fmt.Sprintf("%s\n\n%s", descriptions["main"], descriptions["warning_message"]),
|
Description: fmt.Sprintf("%s\n\n%s", descriptions["main"], descriptions["warning_message"]),
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
|
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
||||||
|
|
@ -23,11 +22,6 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
)
|
)
|
||||||
|
|
||||||
// publicIpRangesDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var publicIpRangesDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &publicIpRangesDataSource{}
|
_ datasource.DataSource = &publicIpRangesDataSource{}
|
||||||
|
|
@ -69,14 +63,6 @@ func (d *publicIpRangesDataSource) Configure(ctx context.Context, req datasource
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !publicIpRangesDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_public_ip_ranges", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
publicIpRangesDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -104,7 +90,7 @@ func (d *publicIpRangesDataSource) Schema(_ context.Context, _ datasource.Schema
|
||||||
description := "A list of all public IP ranges that STACKIT uses."
|
description := "A list of all public IP ranges that STACKIT uses."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription(description),
|
MarkdownDescription: description,
|
||||||
Description: description,
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
|
|
@ -142,7 +128,7 @@ func (d *publicIpRangesDataSource) Read(ctx context.Context, req datasource.Read
|
||||||
if resp.Diagnostics.HasError() {
|
if resp.Diagnostics.HasError() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
publicIpRangeResp, err := d.client.ListPublicIpRangesExecute(ctx)
|
publicIpRangeResp, err := d.client.ListPublicIPRangesExecute(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
|
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
|
||||||
if ok && oapiErr.StatusCode == http.StatusNotFound {
|
if ok && oapiErr.StatusCode == http.StatusNotFound {
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// securityGroupDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var securityGroupDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &securityGroupDataSource{}
|
_ datasource.DataSource = &securityGroupDataSource{}
|
||||||
|
|
@ -58,14 +52,6 @@ func (d *securityGroupDataSource) Configure(ctx context.Context, req datasource.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !securityGroupDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_security_group", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
securityGroupDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -88,9 +74,10 @@ func (d *securityGroupDataSource) Configure(ctx context.Context, req datasource.
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *securityGroupDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (r *securityGroupDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Security group datasource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Security group datasource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Security group datasource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`security_group_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`security_group_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &securityGroupResource{}
|
_ resource.Resource = &securityGroupResource{}
|
||||||
|
|
@ -77,14 +71,6 @@ func (r *securityGroupResource) Configure(ctx context.Context, req resource.Conf
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_security_group", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -111,9 +97,10 @@ func (r *securityGroupResource) Configure(ctx context.Context, req resource.Conf
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *securityGroupResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *securityGroupResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Security group resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Security group resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Security group resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`security_group_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`security_group_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// securityGroupRuleDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var securityGroupRuleDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &securityGroupRuleDataSource{}
|
_ datasource.DataSource = &securityGroupRuleDataSource{}
|
||||||
|
|
@ -58,14 +52,6 @@ func (d *securityGroupRuleDataSource) Configure(ctx context.Context, req datasou
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !securityGroupRuleDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_security_group_rule", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
securityGroupRuleDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -89,10 +75,11 @@ func (d *securityGroupRuleDataSource) Configure(ctx context.Context, req datasou
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *securityGroupRuleDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (r *securityGroupRuleDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
directionOptions := []string{"ingress", "egress"}
|
directionOptions := []string{"ingress", "egress"}
|
||||||
|
description := "Security group datasource schema. Must have a `region` specified in the provider configuration."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Security group datasource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Security group datasource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal datasource ID. It is structured as \"`project_id`,`security_group_id`,`security_group_rule_id`\".",
|
Description: "Terraform's internal datasource ID. It is structured as \"`project_id`,`security_group_id`,`security_group_rule_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &securityGroupRuleResource{}
|
_ resource.Resource = &securityGroupRuleResource{}
|
||||||
|
|
@ -121,14 +115,6 @@ func (r *securityGroupRuleResource) Configure(ctx context.Context, req resource.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_security_group_rule", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -202,10 +188,11 @@ func (r securityGroupRuleResource) ValidateConfig(ctx context.Context, req resou
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *securityGroupRuleResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *securityGroupRuleResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
directionOptions := []string{"ingress", "egress"}
|
directionOptions := []string{"ingress", "egress"}
|
||||||
|
description := "Security group rule resource schema. Must have a `region` specified in the provider configuration."
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Security group rule resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Security group rule resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`security_group_id`,`security_group_rule_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`security_group_id`,`security_group_rule_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ package server
|
||||||
|
|
||||||
const markdownDescription = `
|
const markdownDescription = `
|
||||||
Server resource schema. Must have a region specified in the provider configuration.` + "\n" + `
|
Server resource schema. Must have a region specified in the provider configuration.` + "\n" + `
|
||||||
~> 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` + "\n" + `
|
## Example Usage` + "\n" + `
|
||||||
|
|
||||||
### With key pair` + "\n" +
|
### With key pair` + "\n" +
|
||||||
|
|
||||||
"```terraform" + `
|
"```terraform" + `
|
||||||
resource "stackit_key_pair" "keypair" {
|
resource "stackit_key_pair" "keypair" {
|
||||||
name = "example-key-pair"
|
name = "example-key-pair"
|
||||||
|
|
@ -28,7 +26,6 @@ resource "stackit_server" "user-data-from-file" {
|
||||||
` + "\n```" + `
|
` + "\n```" + `
|
||||||
|
|
||||||
### Boot from volume` + "\n" +
|
### Boot from volume` + "\n" +
|
||||||
|
|
||||||
"```terraform" + `
|
"```terraform" + `
|
||||||
resource "stackit_server" "boot-from-volume" {
|
resource "stackit_server" "boot-from-volume" {
|
||||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||||
|
|
@ -45,7 +42,6 @@ resource "stackit_server" "boot-from-volume" {
|
||||||
` + "\n```" + `
|
` + "\n```" + `
|
||||||
|
|
||||||
### Boot from existing volume` + "\n" +
|
### Boot from existing volume` + "\n" +
|
||||||
|
|
||||||
"```terraform" + `
|
"```terraform" + `
|
||||||
resource "stackit_volume" "example-volume" {
|
resource "stackit_volume" "example-volume" {
|
||||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||||
|
|
@ -72,7 +68,6 @@ resource "stackit_server" "boot-from-volume" {
|
||||||
` + "\n```" + `
|
` + "\n```" + `
|
||||||
|
|
||||||
### Network setup` + "\n" +
|
### Network setup` + "\n" +
|
||||||
|
|
||||||
"```terraform" + `
|
"```terraform" + `
|
||||||
resource "stackit_server" "server-with-network" {
|
resource "stackit_server" "server-with-network" {
|
||||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||||
|
|
@ -125,7 +120,6 @@ resource "stackit_server_network_interface_attach" "nic-attachment" {
|
||||||
` + "\n```" + `
|
` + "\n```" + `
|
||||||
|
|
||||||
### Server with attached volume` + "\n" +
|
### Server with attached volume` + "\n" +
|
||||||
|
|
||||||
"```terraform" + `
|
"```terraform" + `
|
||||||
resource "stackit_volume" "example-volume" {
|
resource "stackit_volume" "example-volume" {
|
||||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||||
|
|
@ -156,7 +150,6 @@ resource "stackit_server_volume_attach" "attach_volume" {
|
||||||
` + "\n```" + `
|
` + "\n```" + `
|
||||||
|
|
||||||
### Server with user data (cloud-init)` + "\n" +
|
### Server with user data (cloud-init)` + "\n" +
|
||||||
|
|
||||||
"```terraform" + `
|
"```terraform" + `
|
||||||
resource "stackit_server" "user-data" {
|
resource "stackit_server" "user-data" {
|
||||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// serverDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var serverDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &serverDataSource{}
|
_ datasource.DataSource = &serverDataSource{}
|
||||||
|
|
@ -82,14 +76,6 @@ func (d *serverDataSource) Configure(ctx context.Context, req datasource.Configu
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !serverDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_server", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
serverDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -112,9 +98,10 @@ func (d *serverDataSource) Configure(ctx context.Context, req datasource.Configu
|
||||||
|
|
||||||
// Schema defines the schema for the datasource.
|
// Schema defines the schema for the datasource.
|
||||||
func (r *serverDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (r *serverDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Server datasource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Server datasource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Server datasource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &serverResource{}
|
_ resource.Resource = &serverResource{}
|
||||||
|
|
@ -162,14 +156,6 @@ func (r *serverResource) Configure(ctx context.Context, req resource.ConfigureRe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_server", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -982,9 +968,11 @@ func toCreatePayload(ctx context.Context, model *Model) (*iaas.CreateServerPaylo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var userData *string
|
var userData *[]byte
|
||||||
if !model.UserData.IsNull() && !model.UserData.IsUnknown() {
|
if !model.UserData.IsNull() && !model.UserData.IsUnknown() {
|
||||||
encodedUserData := base64.StdEncoding.EncodeToString([]byte(model.UserData.ValueString()))
|
src := []byte(model.UserData.ValueString())
|
||||||
|
encodedUserData := make([]byte, base64.StdEncoding.EncodedLen(len(src)))
|
||||||
|
base64.StdEncoding.Encode(encodedUserData, src)
|
||||||
userData = &encodedUserData
|
userData = &encodedUserData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ func TestToCreatePayload(t *testing.T) {
|
||||||
ImageId: utils.Ptr("image"),
|
ImageId: utils.Ptr("image"),
|
||||||
KeypairName: utils.Ptr("keypair"),
|
KeypairName: utils.Ptr("keypair"),
|
||||||
MachineType: utils.Ptr("machine_type"),
|
MachineType: utils.Ptr("machine_type"),
|
||||||
UserData: utils.Ptr(base64EncodedUserData),
|
UserData: utils.Ptr([]byte(base64EncodedUserData)),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
@ -258,7 +258,7 @@ func TestToCreatePayload(t *testing.T) {
|
||||||
ImageId: utils.Ptr("image"),
|
ImageId: utils.Ptr("image"),
|
||||||
KeypairName: utils.Ptr("keypair"),
|
KeypairName: utils.Ptr("keypair"),
|
||||||
MachineType: utils.Ptr("machine_type"),
|
MachineType: utils.Ptr("machine_type"),
|
||||||
UserData: utils.Ptr(base64EncodedUserData),
|
UserData: utils.Ptr([]byte(base64EncodedUserData)),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &networkInterfaceAttachResource{}
|
_ resource.Resource = &networkInterfaceAttachResource{}
|
||||||
|
|
@ -69,14 +63,6 @@ func (r *networkInterfaceAttachResource) Configure(ctx context.Context, req reso
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_server_service_account_attach", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -103,9 +89,10 @@ func (r *networkInterfaceAttachResource) Configure(ctx context.Context, req reso
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *networkInterfaceAttachResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *networkInterfaceAttachResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Service account attachment resource schema. Attaches a service account to a server. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Service account attachment resource schema. Attaches a service account to a server. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Service account attachment resource schema. Attaches a service account to a server. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`,`service_account_email`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`,`service_account_email`\".",
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// volumeDataSourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var volumeDataSourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ datasource.DataSource = &volumeDataSource{}
|
_ datasource.DataSource = &volumeDataSource{}
|
||||||
|
|
@ -59,14 +53,6 @@ func (d *volumeDataSource) Configure(ctx context.Context, req datasource.Configu
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !volumeDataSourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_volume", "data source")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
volumeDataSourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
apiClient, err = iaas.NewAPIClient(
|
apiClient, err = iaas.NewAPIClient(
|
||||||
config.WithCustomAuth(providerData.RoundTripper),
|
config.WithCustomAuth(providerData.RoundTripper),
|
||||||
|
|
@ -89,9 +75,10 @@ func (d *volumeDataSource) Configure(ctx context.Context, req datasource.Configu
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *volumeDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
func (r *volumeDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
description := "Volume resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Volume resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Volume resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`volume_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`volume_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,10 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &volumeResource{}
|
_ resource.Resource = &volumeResource{}
|
||||||
|
|
@ -110,14 +104,6 @@ func (r *volumeResource) Configure(ctx context.Context, req resource.ConfigureRe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_volume", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -144,9 +130,10 @@ func (r *volumeResource) Configure(ctx context.Context, req resource.ConfigureRe
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *volumeResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *volumeResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Volume resource schema. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Volume resource schema. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Volume resource schema. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`volume_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`volume_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,9 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/features"
|
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
|
|
||||||
// This is a workaround for the lack of a global state in the provider and
|
|
||||||
// needs to exist because the Configure method is called twice.
|
|
||||||
var resourceBetaCheckDone bool
|
|
||||||
|
|
||||||
// Ensure the implementation satisfies the expected interfaces.
|
// Ensure the implementation satisfies the expected interfaces.
|
||||||
var (
|
var (
|
||||||
_ resource.Resource = &volumeAttachResource{}
|
_ resource.Resource = &volumeAttachResource{}
|
||||||
|
|
@ -71,14 +65,6 @@ func (r *volumeAttachResource) Configure(ctx context.Context, req resource.Confi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resourceBetaCheckDone {
|
|
||||||
features.CheckBetaResourcesEnabled(ctx, &providerData, &resp.Diagnostics, "stackit_server_volume_attach", "resource")
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resourceBetaCheckDone = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiClient *iaas.APIClient
|
var apiClient *iaas.APIClient
|
||||||
var err error
|
var err error
|
||||||
if providerData.IaaSCustomEndpoint != "" {
|
if providerData.IaaSCustomEndpoint != "" {
|
||||||
|
|
@ -105,9 +91,10 @@ func (r *volumeAttachResource) Configure(ctx context.Context, req resource.Confi
|
||||||
|
|
||||||
// Schema defines the schema for the resource.
|
// Schema defines the schema for the resource.
|
||||||
func (r *volumeAttachResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
func (r *volumeAttachResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||||
|
description := "Volume attachment resource schema. Attaches a volume to a server. Must have a `region` specified in the provider configuration."
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
MarkdownDescription: features.AddBetaDescription("Volume attachment resource schema. Attaches a volume to a server. Must have a `region` specified in the provider configuration."),
|
MarkdownDescription: description,
|
||||||
Description: "Volume attachment resource schema. Attaches a volume to a server. Must have a `region` specified in the provider configuration.",
|
Description: description,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"id": schema.StringAttribute{
|
"id": schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`,`volume_id`\".",
|
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`server_id`,`volume_id`\".",
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,6 @@ func IaaSProviderConfig() string {
|
||||||
return `
|
return `
|
||||||
provider "stackit" {
|
provider "stackit" {
|
||||||
region = "eu01"
|
region = "eu01"
|
||||||
enable_beta_resources = true
|
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue