diff --git a/README.md b/README.md index e9cb48bb..f32a5784 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,33 @@ terraform { Note: AWS specific checks must be skipped as they do not work on STACKIT. For details on what those validations do, see [here](https://developer.hashicorp.com/terraform/language/settings/backends/s3#configuration). +## Opting into Beta Resources + +To use beta resources in the STACKIT Terraform provider, follow these steps: + +1. **Provider Configuration Option** + + Set the `enable_beta_resources` option in the provider configuration. This is a boolean attribute that can be either `true` or `false`. + + ```hcl + provider "stackit" { + region = "eu01" + enable_beta_resources = true + } + ``` + +2. **Environment Variable** + + Set the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable to `"true"` or `"false"`. Other values will be ignored and will produce a warning. + + ```sh + export STACKIT_TF_ENABLE_BETA_RESOURCES=true + ``` + +> **Note**: The environment variable takes precedence over the provider configuration option. This means that if the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable is set to a valid value (`"true"` or `"false"`), it will override the `enable_beta_resources` option specified in the provider configuration. + +For more details, please refer to the [beta resources configuration guide](TODO-LINK). + ## Acceptance Tests Terraform acceptance tests are run using the command `make test-acceptance-tf`. For all services, diff --git a/docs/guides/opting_into_beta_resources.md b/docs/guides/opting_into_beta_resources.md new file mode 100644 index 00000000..46384b12 --- /dev/null +++ b/docs/guides/opting_into_beta_resources.md @@ -0,0 +1,43 @@ +--- +page_title: "Configuring Beta Resources in the STACKIT Terraform Provider" +--- +# Configuring Beta Resources in the STACKIT Terraform Provider + +### Overview + +This guide explains how to opt into beta resources within the STACKIT Terraform provider. Beta resources are new services and features from STACKIT that are still in development and might not yet have a stable API. + +Opting into beta functionality allows users to experiment with new features and services before their official release, without compromising the stability of other resources and the provider itself. However, it's important to remember that beta resources may not be as stable as fully released counterparts, so use them with caution and provide feedback to help improve these services. + +### The Process of Opting into the Beta + +To use beta resources in the STACKIT Terraform provider, you have two options: + +#### Option 1: Provider Configuration + +Set the `enable_beta_resources` option in the provider configuration. This is a boolean attribute that can be either `true` or `false`. + +```hcl +provider "stackit" { + region = "eu01" + enable_beta_resources = true +} +``` + +#### Option 2: Environment Variable + +Set the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable to `"true"` or `"false"`. Other values will be ignored and will produce a warning. + +```sh +export STACKIT_TF_ENABLE_BETA_RESOURCES=true +``` + +> **Note**: **The environment variable takes precedence over the provider configuration option.** +> +> This means that if the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable is set to a valid value (`"true"` or `"false"`), it will override the `enable_beta_resources` option specified in the provider configuration. + +### Listing Beta Resources + +Currently, there are no beta resources available. This section will be updated as new beta services are introduced. + +> **Tip**: Check back regularly or refer to the [STACKIT provider documentation](#) for the latest updates on beta resources. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 84906b10..470d8f75 100644 --- a/docs/index.md +++ b/docs/index.md @@ -143,6 +143,7 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de - `argus_custom_endpoint` (String) Custom endpoint for the Argus service - `credentials_path` (String) Path of JSON from where the credentials are read. Takes precedence over the env var `STACKIT_CREDENTIALS_PATH`. Default value is `~/.stackit/credentials.json`. - `dns_custom_endpoint` (String) Custom endpoint for the DNS service +- `enable_beta_resources` (Boolean) Enable beta resources. Default is false. - `iaas_custom_endpoint` (String) Custom endpoint for the IaaS service - `jwks_custom_endpoint` (String, Deprecated) Custom endpoint for the jwks API, which is used to get the json web key sets (jwks) to validate tokens when using the key flow - `loadbalancer_custom_endpoint` (String) Custom endpoint for the Load Balancer service diff --git a/stackit/internal/features/beta.go b/stackit/internal/features/beta.go index 552d78e1..0ccf0e45 100644 --- a/stackit/internal/features/beta.go +++ b/stackit/internal/features/beta.go @@ -46,3 +46,8 @@ func CheckBetaResourcesEnabled(ctx context.Context, data *core.ProviderData, dia } core.LogAndAddWarningBeta(ctx, diags, resourceName) } + +func AddBetaDescription(description string) string { + // Callout block: https://developer.hashicorp.com/terraform/registry/providers/docs#callouts + return fmt.Sprintf("%s\n\n!> This resource is in beta and may be subject to breaking changes in the future. Use with caution.", description) +} diff --git a/templates/guides/opting_into_beta_resources.md.tmpl b/templates/guides/opting_into_beta_resources.md.tmpl new file mode 100644 index 00000000..46384b12 --- /dev/null +++ b/templates/guides/opting_into_beta_resources.md.tmpl @@ -0,0 +1,43 @@ +--- +page_title: "Configuring Beta Resources in the STACKIT Terraform Provider" +--- +# Configuring Beta Resources in the STACKIT Terraform Provider + +### Overview + +This guide explains how to opt into beta resources within the STACKIT Terraform provider. Beta resources are new services and features from STACKIT that are still in development and might not yet have a stable API. + +Opting into beta functionality allows users to experiment with new features and services before their official release, without compromising the stability of other resources and the provider itself. However, it's important to remember that beta resources may not be as stable as fully released counterparts, so use them with caution and provide feedback to help improve these services. + +### The Process of Opting into the Beta + +To use beta resources in the STACKIT Terraform provider, you have two options: + +#### Option 1: Provider Configuration + +Set the `enable_beta_resources` option in the provider configuration. This is a boolean attribute that can be either `true` or `false`. + +```hcl +provider "stackit" { + region = "eu01" + enable_beta_resources = true +} +``` + +#### Option 2: Environment Variable + +Set the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable to `"true"` or `"false"`. Other values will be ignored and will produce a warning. + +```sh +export STACKIT_TF_ENABLE_BETA_RESOURCES=true +``` + +> **Note**: **The environment variable takes precedence over the provider configuration option.** +> +> This means that if the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable is set to a valid value (`"true"` or `"false"`), it will override the `enable_beta_resources` option specified in the provider configuration. + +### Listing Beta Resources + +Currently, there are no beta resources available. This section will be updated as new beta services are introduced. + +> **Tip**: Check back regularly or refer to the [STACKIT provider documentation](#) for the latest updates on beta resources. \ No newline at end of file