diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a27015c..6e69c1432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ nav_order: 1 -## [MAJOR.MINOR.PATCH] - YYYY-MM-DD +## [4.31.0] - 2024-12-18 - Add `alloydbomni` BETA resource and datasource - Add `aiven_alloydbomni_user` BETA resource and datasource diff --git a/docs/resources/alloydbomni.md b/docs/resources/alloydbomni.md index c99cfe2b3..d7184a1bb 100644 --- a/docs/resources/alloydbomni.md +++ b/docs/resources/alloydbomni.md @@ -15,7 +15,35 @@ Creates and manages an Aiven for AlloyDB Omni service. **This resource is in the beta stage and may change without notice.** Set the `PROVIDER_AIVEN_ENABLE_BETA` environment variable to use the resource. - +## Example Usage + +```terraform +resource "aiven_alloydbomni" "example_alloydbomni" { + project = data.aiven_project.example_project.project + cloud_name = "google-europe-west1" + plan = "startup-4" + service_name = "example-alloydbomni-service" + maintenance_window_dow = "monday" + maintenance_window_time = "10:00:00" + + tag { + key = "test" + value = "val" + } + + alloydbomni_user_config { + public_access { + pg = true + prometheus = false + } + + pg { + idle_in_transaction_session_timeout = 900 + log_min_duration_statement = -1 + } + } +} +``` ## Schema @@ -307,3 +335,11 @@ Read-Only: - `route` (String) - `ssl` (Boolean) - `usage` (String) + +## Import + +Import is supported using the following syntax: + +```shell +terraform import aiven_alloydbomni.example_alloydbomni PROJECT/SERVICE_NAME +``` diff --git a/examples/resources/aiven_alloydbomni/import.sh b/examples/resources/aiven_alloydbomni/import.sh new file mode 100644 index 000000000..ef03a7a10 --- /dev/null +++ b/examples/resources/aiven_alloydbomni/import.sh @@ -0,0 +1 @@ +terraform import aiven_alloydbomni.example_alloydbomni PROJECT/SERVICE_NAME diff --git a/examples/resources/aiven_alloydbomni/resource.tf b/examples/resources/aiven_alloydbomni/resource.tf new file mode 100644 index 000000000..2fa4113c3 --- /dev/null +++ b/examples/resources/aiven_alloydbomni/resource.tf @@ -0,0 +1,25 @@ +resource "aiven_alloydbomni" "example_alloydbomni" { + project = data.aiven_project.example_project.project + cloud_name = "google-europe-west1" + plan = "startup-4" + service_name = "example-alloydbomni-service" + maintenance_window_dow = "monday" + maintenance_window_time = "10:00:00" + + tag { + key = "test" + value = "val" + } + + alloydbomni_user_config { + public_access { + pg = true + prometheus = false + } + + pg { + idle_in_transaction_session_timeout = 900 + log_min_duration_statement = -1 + } + } +} diff --git a/go.mod b/go.mod index 61e376d2f..664cb4f8a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( github.com/aiven/aiven-go-client/v2 v2.33.0 - github.com/aiven/go-client-codegen v0.70.0 + github.com/aiven/go-client-codegen v0.71.0 github.com/avast/retry-go v3.0.0+incompatible github.com/dave/jennifer v1.7.1 github.com/docker/go-units v0.5.0 diff --git a/go.sum b/go.sum index 658b831a9..2d3b16121 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ github.com/aiven/aiven-go-client/v2 v2.33.0 h1:7hsM3/2lVog/P9ls/gLeba5feNVQjK8rI github.com/aiven/aiven-go-client/v2 v2.33.0/go.mod h1:qXBgER0dtjJa1V3l7kzpizuAGjFCkgahhHL5OpoM2ZM= github.com/aiven/go-api-schemas v1.106.0 h1:qncRsbiaGnU9JE9fmTFHclTCBem+t+6EPMXGXM35w2c= github.com/aiven/go-api-schemas v1.106.0/go.mod h1:z7dGvufm6If4gOdVr7dWTuFZmll9FOZr5Z5CSxGpebA= -github.com/aiven/go-client-codegen v0.70.0 h1:i8DIbTxx4sZ7dUc4g2ILsJ7phvl1IEi8PfzblTDlWVA= -github.com/aiven/go-client-codegen v0.70.0/go.mod h1:QKN/GgLMGWd6+gPEucXlZPi5vC3C6RpD3UeBRQOLI1Y= +github.com/aiven/go-client-codegen v0.71.0 h1:SGiHrfbU8RiqVegQGV3BStnbIdFke+15lxadlPORqfI= +github.com/aiven/go-client-codegen v0.71.0/go.mod h1:QKN/GgLMGWd6+gPEucXlZPi5vC3C6RpD3UeBRQOLI1Y= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= diff --git a/internal/sdkprovider/service/serviceintegration/service_integration.go b/internal/sdkprovider/service/serviceintegration/service_integration.go index 007f6ca59..dee5d5ed8 100644 --- a/internal/sdkprovider/service/serviceintegration/service_integration.go +++ b/internal/sdkprovider/service/serviceintegration/service_integration.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/samber/lo" "github.com/aiven/terraform-provider-aiven/internal/common" "github.com/aiven/terraform-provider-aiven/internal/schemautil" @@ -23,6 +24,13 @@ import ( const serviceIntegrationEndpointRegExp = "^[a-zA-Z0-9_-]*\\/{1}[a-zA-Z0-9_-]*$" +func serviceIntegrationTypeChoices() []string { + // application_service_credential is not ready for use + return lo.Filter(service.IntegrationTypeChoices(), func(s string, _ int) bool { + return s != "application_service_credential" + }) +} + func aivenServiceIntegrationSchema() map[string]*schema.Schema { s := map[string]*schema.Schema{ "integration_id": { @@ -52,11 +60,11 @@ func aivenServiceIntegrationSchema() map[string]*schema.Schema { Type: schema.TypeString, }, "integration_type": { - Description: userconfig.Desc("Type of the service integration").PossibleValuesString(service.IntegrationTypeChoices()...).Build(), + Description: userconfig.Desc("Type of the service integration").PossibleValuesString(serviceIntegrationTypeChoices()...).Build(), ForceNew: true, Required: true, Type: schema.TypeString, - ValidateFunc: validation.StringInSlice(service.IntegrationTypeChoices(), false), + ValidateFunc: validation.StringInSlice(serviceIntegrationTypeChoices(), false), }, "project": { Description: "Project the integration belongs to.",