From 6d483c134bf9dd7f9db42fb457e7a1b3eae9fca9 Mon Sep 17 00:00:00 2001 From: Murad Biashimov Date: Thu, 12 Dec 2024 11:55:26 +0100 Subject: [PATCH] feat: add disaster_recovery integration type (#1867) --- CHANGELOG.md | 1 + changelog/differ_test.go | 15 ++++ docs/data-sources/alloydbomni.md | 2 +- docs/data-sources/cassandra.md | 2 +- docs/data-sources/clickhouse.md | 2 +- docs/data-sources/dragonfly.md | 2 +- docs/data-sources/external_identity.md | 2 +- docs/data-sources/flink.md | 2 +- docs/data-sources/grafana.md | 2 +- docs/data-sources/kafka.md | 2 +- docs/data-sources/kafka_connect.md | 2 +- docs/data-sources/kafka_mirrormaker.md | 2 +- docs/data-sources/m3aggregator.md | 2 +- docs/data-sources/m3db.md | 2 +- docs/data-sources/mysql.md | 2 +- docs/data-sources/opensearch.md | 2 +- docs/data-sources/pg.md | 2 +- docs/data-sources/redis.md | 2 +- docs/data-sources/thanos.md | 2 +- docs/data-sources/valkey.md | 2 +- docs/resources/alloydbomni.md | 4 +- docs/resources/cassandra.md | 4 +- docs/resources/clickhouse.md | 6 +- docs/resources/dragonfly.md | 4 +- docs/resources/flink.md | 4 +- docs/resources/grafana.md | 4 +- docs/resources/kafka.md | 4 +- docs/resources/kafka_connect.md | 4 +- docs/resources/kafka_mirrormaker.md | 4 +- docs/resources/m3aggregator.md | 4 +- docs/resources/m3db.md | 4 +- docs/resources/mysql.md | 4 +- docs/resources/opensearch.md | 4 +- docs/resources/pg.md | 4 +- docs/resources/redis.md | 4 +- docs/resources/thanos.md | 4 +- docs/resources/valkey.md | 4 +- internal/acctest/acctest.go | 2 +- internal/schemautil/custom_diff.go | 2 +- internal/schemautil/helpers.go | 28 ++++---- internal/schemautil/schemautil.go | 20 +----- internal/schemautil/service.go | 68 ++++++++++++++----- internal/schemautil/userconfig/desc.go | 7 +- internal/schemautil/wait.go | 10 ++- .../service/clickhouse/clickhouse.go | 20 ------ internal/sdkprovider/service/pg/pg_test.go | 55 +++++++++++++++ 46 files changed, 206 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50018cda8..a0a9a1a9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ nav_order: 1 ## [MAJOR.MINOR.PATCH] - YYYY-MM-DD +- Add `disaster_recovery` service integration type support - Add `alloydbomni` BETA resource and datasource - Add `aiven_alloydbomni_user` BETA resource and datasource - Add `aiven_alloydbomni_database` BETA resource and datasource diff --git a/changelog/differ_test.go b/changelog/differ_test.go index bd164046e..4b25fc617 100644 --- a/changelog/differ_test.go +++ b/changelog/differ_test.go @@ -30,6 +30,21 @@ func TestCompare(t *testing.T) { Description: "Foo. The possible values are `foo`, `baz`.", }, }, + { + name: "change enum", + expect: "Change `foo` resource field `bar`: add `foo`", + kind: ResourceRootType, + old: &Item{ + Type: schema.TypeString, + Path: "foo.bar", + Description: "Foo. The possible values is `bar`", + }, + new: &Item{ + Type: schema.TypeString, + Path: "foo.bar", + Description: "Foo. The possible values are `foo`, `bar`.", + }, + }, { name: "add resource field", expect: "Add `foo` resource field `bar`: Foo", diff --git a/docs/data-sources/alloydbomni.md b/docs/data-sources/alloydbomni.md index 7c0f45e44..3ba12f275 100644 --- a/docs/data-sources/alloydbomni.md +++ b/docs/data-sources/alloydbomni.md @@ -44,7 +44,7 @@ the `PROVIDER_AIVEN_ENABLE_BETA` environment variable to use the resource. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_account_credentials` (String, Sensitive) Your [Google service account key](https://cloud.google.com/iam/docs/service-account-creds#key-types) in JSON format. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/cassandra.md b/docs/data-sources/cassandra.md index 39ae598dd..d557f0f74 100644 --- a/docs/data-sources/cassandra.md +++ b/docs/data-sources/cassandra.md @@ -45,7 +45,7 @@ data "aiven_cassandra" "example_cassandra" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/clickhouse.md b/docs/data-sources/clickhouse.md index ae1f405a0..12380951c 100644 --- a/docs/data-sources/clickhouse.md +++ b/docs/data-sources/clickhouse.md @@ -45,7 +45,7 @@ data "aiven_clickhouse" "example_clickhouse" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Integrations with other services. Service integrations are only applied at service creation. (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/dragonfly.md b/docs/data-sources/dragonfly.md index f174d79b5..e6f06d457 100644 --- a/docs/data-sources/dragonfly.md +++ b/docs/data-sources/dragonfly.md @@ -45,7 +45,7 @@ data "aiven_dragonfly" "example_dragonfly" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/external_identity.md b/docs/data-sources/external_identity.md index 12ace94eb..4926642b9 100644 --- a/docs/data-sources/external_identity.md +++ b/docs/data-sources/external_identity.md @@ -22,7 +22,7 @@ the `PROVIDER_AIVEN_ENABLE_BETA` environment variable to use the resource. ### Required -- `external_service_name` (String) The name of the external service. The possible values are `github`. +- `external_service_name` (String) The name of the external service. The possible value is `github`. - `external_user_id` (String) The user's ID on the external service. - `internal_user_id` (String) The Aiven user ID. - `organization_id` (String) The ID of the Aiven organization that the user is part of. diff --git a/docs/data-sources/flink.md b/docs/data-sources/flink.md index 8b60397d8..cad91e81f 100644 --- a/docs/data-sources/flink.md +++ b/docs/data-sources/flink.md @@ -45,7 +45,7 @@ data "aiven_flink" "example_flink" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/grafana.md b/docs/data-sources/grafana.md index bdcdd859a..7966f40d6 100644 --- a/docs/data-sources/grafana.md +++ b/docs/data-sources/grafana.md @@ -45,7 +45,7 @@ data "aiven_grafana" "example_grafana" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/kafka.md b/docs/data-sources/kafka.md index 28f09dab3..672cbaf8a 100644 --- a/docs/data-sources/kafka.md +++ b/docs/data-sources/kafka.md @@ -47,7 +47,7 @@ data "aiven_kafka" "example_kafka" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/kafka_connect.md b/docs/data-sources/kafka_connect.md index e4e56cad6..d26bc00d6 100644 --- a/docs/data-sources/kafka_connect.md +++ b/docs/data-sources/kafka_connect.md @@ -44,7 +44,7 @@ data "aiven_kafka_connect" "example_kafka_connect" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/kafka_mirrormaker.md b/docs/data-sources/kafka_mirrormaker.md index 00878fd2e..cd7ad0602 100644 --- a/docs/data-sources/kafka_mirrormaker.md +++ b/docs/data-sources/kafka_mirrormaker.md @@ -44,7 +44,7 @@ data "aiven_kafka_mirrormaker" "mm1" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/m3aggregator.md b/docs/data-sources/m3aggregator.md index 25d0351bd..ceebd9d25 100644 --- a/docs/data-sources/m3aggregator.md +++ b/docs/data-sources/m3aggregator.md @@ -45,7 +45,7 @@ data "aiven_m3aggregator" "m3a" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/m3db.md b/docs/data-sources/m3db.md index 9b2577f2a..b4a855091 100644 --- a/docs/data-sources/m3db.md +++ b/docs/data-sources/m3db.md @@ -45,7 +45,7 @@ data "aiven_m3db" "example_m3db" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/mysql.md b/docs/data-sources/mysql.md index f3d96aa77..2cc3128ca 100644 --- a/docs/data-sources/mysql.md +++ b/docs/data-sources/mysql.md @@ -45,7 +45,7 @@ data "aiven_mysql" "mysql1" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/opensearch.md b/docs/data-sources/opensearch.md index aa0d1b0dd..d3ea5d128 100644 --- a/docs/data-sources/opensearch.md +++ b/docs/data-sources/opensearch.md @@ -45,7 +45,7 @@ data "aiven_opensearch" "os1" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/pg.md b/docs/data-sources/pg.md index 32a8a0732..ac5b9d4a7 100644 --- a/docs/data-sources/pg.md +++ b/docs/data-sources/pg.md @@ -45,7 +45,7 @@ data "aiven_pg" "example_postgres" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/redis.md b/docs/data-sources/redis.md index dded60bb3..984a235cc 100644 --- a/docs/data-sources/redis.md +++ b/docs/data-sources/redis.md @@ -45,7 +45,7 @@ data "aiven_redis" "redis1" { - `redis` (List of Object, Sensitive) Redis server provided values (see [below for nested schema](#nestedatt--redis)) - `redis_user_config` (List of Object) Redis user configurable settings. **Warning:** There's no way to reset advanced configuration options to default. Options that you add cannot be removed later (see [below for nested schema](#nestedatt--redis_user_config)) - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/thanos.md b/docs/data-sources/thanos.md index d7a750862..77fe64d0b 100644 --- a/docs/data-sources/thanos.md +++ b/docs/data-sources/thanos.md @@ -43,7 +43,7 @@ data "aiven_thanos" "example_thanos" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/data-sources/valkey.md b/docs/data-sources/valkey.md index a657689c7..e1b4060eb 100644 --- a/docs/data-sources/valkey.md +++ b/docs/data-sources/valkey.md @@ -43,7 +43,7 @@ data "aiven_valkey" "example_valkey" { - `plan` (String) Defines what kind of computing resources are allocated for the service. It can be changed after creation, though there are some restrictions when going to a smaller plan such as the new plan must have sufficient amount of disk space to store all current data and switching to a plan with fewer nodes might not be supported. The basic plan names are `hobbyist`, `startup-x`, `business-x` and `premium-x` where `x` is (roughly) the amount of memory on each node (also other attributes like number of CPUs and amount of disk space varies but naming is based on memory). The available options can be seen from the [Aiven pricing page](https://aiven.io/pricing). - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_host` (String) The hostname of the service. -- `service_integrations` (List of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) +- `service_integrations` (Set of Object) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedatt--service_integrations)) - `service_password` (String, Sensitive) Password used for connecting to the service, if applicable - `service_port` (Number) The port of the service - `service_type` (String) Aiven internal service type code diff --git a/docs/resources/alloydbomni.md b/docs/resources/alloydbomni.md index f7ec8efcb..7d4de82d9 100644 --- a/docs/resources/alloydbomni.md +++ b/docs/resources/alloydbomni.md @@ -37,7 +37,7 @@ the `PROVIDER_AIVEN_ENABLE_BETA` environment variable to use the resource. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `service_account_credentials` (String, Sensitive) Your [Google service account key](https://cloud.google.com/iam/docs/service-account-creds#key-types) in JSON format. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -260,7 +260,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration. The possible value is `read_replica`. - `source_service_name` (String) Name of the source service diff --git a/docs/resources/cassandra.md b/docs/resources/cassandra.md index b674582e8..4a1795096 100644 --- a/docs/resources/cassandra.md +++ b/docs/resources/cassandra.md @@ -50,7 +50,7 @@ resource "aiven_cassandra" "example_cassandra" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -149,7 +149,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/clickhouse.md b/docs/resources/clickhouse.md index 554921e01..cd22b02f5 100644 --- a/docs/resources/clickhouse.md +++ b/docs/resources/clickhouse.md @@ -42,7 +42,7 @@ resource "aiven_clickhouse" "example_clickhouse" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Integrations with other services. Service integrations are only applied at service creation. (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -142,8 +142,8 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. Supported integrations are `clickhouse_kafka` and `clickhouse_postgresql`. -- `source_service_name` (String) Name of the source service. +- `integration_type` (String) Type of the service integration +- `source_service_name` (String) Name of the source service diff --git a/docs/resources/dragonfly.md b/docs/resources/dragonfly.md index 0f1ddb795..b838c2bc8 100644 --- a/docs/resources/dragonfly.md +++ b/docs/resources/dragonfly.md @@ -44,7 +44,7 @@ resource "aiven_dragonfly" "example_dragonfly" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -166,7 +166,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/flink.md b/docs/resources/flink.md index 0c6d8e42f..38a410c4e 100644 --- a/docs/resources/flink.md +++ b/docs/resources/flink.md @@ -46,7 +46,7 @@ resource "aiven_flink" "example_flink" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -130,7 +130,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/grafana.md b/docs/resources/grafana.md index 9a2eb6a6d..0aab220ec 100644 --- a/docs/resources/grafana.md +++ b/docs/resources/grafana.md @@ -50,7 +50,7 @@ resource "aiven_grafana" "example_grafana" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -303,7 +303,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/kafka.md b/docs/resources/kafka.md index da81254d4..60d2c0209 100644 --- a/docs/resources/kafka.md +++ b/docs/resources/kafka.md @@ -61,7 +61,7 @@ resource "aiven_kafka" "example_kafka" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -386,7 +386,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/kafka_connect.md b/docs/resources/kafka_connect.md index 116d20c61..67c323264 100644 --- a/docs/resources/kafka_connect.md +++ b/docs/resources/kafka_connect.md @@ -85,7 +85,7 @@ resource "aiven_service_integration" "kafka_connect_integration" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -236,7 +236,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/kafka_mirrormaker.md b/docs/resources/kafka_mirrormaker.md index fd0b7cda9..7487caa8d 100644 --- a/docs/resources/kafka_mirrormaker.md +++ b/docs/resources/kafka_mirrormaker.md @@ -49,7 +49,7 @@ resource "aiven_kafka_mirrormaker" "mm1" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -124,7 +124,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/m3aggregator.md b/docs/resources/m3aggregator.md index 168ff46f7..ebb2d5610 100644 --- a/docs/resources/m3aggregator.md +++ b/docs/resources/m3aggregator.md @@ -46,7 +46,7 @@ resource "aiven_m3aggregator" "m3a" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -113,7 +113,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/m3db.md b/docs/resources/m3db.md index 348f8ece9..49e5de062 100644 --- a/docs/resources/m3db.md +++ b/docs/resources/m3db.md @@ -51,7 +51,7 @@ resource "aiven_m3db" "example_m3db" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -264,7 +264,7 @@ Required: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/mysql.md b/docs/resources/mysql.md index 181564a13..131ede067 100644 --- a/docs/resources/mysql.md +++ b/docs/resources/mysql.md @@ -55,7 +55,7 @@ resource "aiven_mysql" "mysql1" { - `mysql` (Block List, Max: 1) MySQL specific server provided values (see [below for nested schema](#nestedblock--mysql)) - `mysql_user_config` (Block List, Max: 1) Mysql user configurable settings. **Warning:** There's no way to reset advanced configuration options to default. Options that you add cannot be removed later (see [below for nested schema](#nestedblock--mysql_user_config)) - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -237,7 +237,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration. The possible value is `read_replica`. - `source_service_name` (String) Name of the source service diff --git a/docs/resources/opensearch.md b/docs/resources/opensearch.md index 2d6173b4c..c503c3c1d 100644 --- a/docs/resources/opensearch.md +++ b/docs/resources/opensearch.md @@ -56,7 +56,7 @@ resource "aiven_opensearch" "os1" { - `opensearch` (Block List, Max: 1) OpenSearch server provided values (see [below for nested schema](#nestedblock--opensearch)) - `opensearch_user_config` (Block List, Max: 1) Opensearch user configurable settings. **Warning:** There's no way to reset advanced configuration options to default. Options that you add cannot be removed later (see [below for nested schema](#nestedblock--opensearch_user_config)) - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -573,7 +573,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/pg.md b/docs/resources/pg.md index aeecdf055..e65936267 100644 --- a/docs/resources/pg.md +++ b/docs/resources/pg.md @@ -68,7 +68,7 @@ resource "aiven_pg" "example_postgres" { - `pg` (Block List, Max: 1) Values provided by the PostgreSQL server. (see [below for nested schema](#nestedblock--pg)) - `pg_user_config` (Block List, Max: 1) Pg user configurable settings. **Warning:** There's no way to reset advanced configuration options to default. Options that you add cannot be removed later (see [below for nested schema](#nestedblock--pg_user_config)) - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -355,7 +355,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration. The possible values are `read_replica` and `disaster_recovery`. - `source_service_name` (String) Name of the source service diff --git a/docs/resources/redis.md b/docs/resources/redis.md index 5de553f69..6e3d3ba24 100644 --- a/docs/resources/redis.md +++ b/docs/resources/redis.md @@ -50,7 +50,7 @@ resource "aiven_redis" "redis1" { - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. - `redis` (Block List, Max: 1) Redis server provided values (see [below for nested schema](#nestedblock--redis)) - `redis_user_config` (Block List, Max: 1) Redis user configurable settings. **Warning:** There's no way to reset advanced configuration options to default. Options that you add cannot be removed later (see [below for nested schema](#nestedblock--redis_user_config)) -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -184,7 +184,7 @@ Optional: Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/thanos.md b/docs/resources/thanos.md index ef662958f..b3a4c6acf 100644 --- a/docs/resources/thanos.md +++ b/docs/resources/thanos.md @@ -45,7 +45,7 @@ resource "aiven_thanos" "example_thanos" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -75,7 +75,7 @@ resource "aiven_thanos" "example_thanos" { Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/docs/resources/valkey.md b/docs/resources/valkey.md index 3770f3b5f..be0bcfa0f 100644 --- a/docs/resources/valkey.md +++ b/docs/resources/valkey.md @@ -42,7 +42,7 @@ resource "aiven_valkey" "example_valkey" { - `maintenance_window_dow` (String) Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc. - `maintenance_window_time` (String) Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format. - `project_vpc_id` (String) Specifies the VPC the service should run in. If the value is not set the service is not run inside a VPC. When set, the value should be given as a reference to set up dependencies correctly and the VPC must be in the same cloud and region as the service itself. Project can be freely moved to and from VPC after creation but doing so triggers migration to new servers so the operation can take significant amount of time to complete if the service has a lot of data. -- `service_integrations` (Block List) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) +- `service_integrations` (Block Set) Service integrations to specify when creating a service. Not applied after initial service creation (see [below for nested schema](#nestedblock--service_integrations)) - `static_ips` (Set of String) Static IPs that are going to be associated with this service. Please assign a value using the 'toset' function. Once a static ip resource is in the 'assigned' state it cannot be unbound from the node again - `tag` (Block Set) Tags are key-value pairs that allow you to categorize services. (see [below for nested schema](#nestedblock--tag)) - `tech_emails` (Block Set) The email addresses for [service contacts](https://aiven.io/docs/platform/howto/technical-emails), who will receive important alerts and updates about this service. You can also set email contacts at the project level. (see [below for nested schema](#nestedblock--tech_emails)) @@ -72,7 +72,7 @@ resource "aiven_valkey" "example_valkey" { Required: -- `integration_type` (String) Type of the service integration. The only supported value at the moment is `read_replica` +- `integration_type` (String) Type of the service integration - `source_service_name` (String) Name of the source service diff --git a/internal/acctest/acctest.go b/internal/acctest/acctest.go index bac597e25..da84036a8 100644 --- a/internal/acctest/acctest.go +++ b/internal/acctest/acctest.go @@ -142,7 +142,7 @@ const ( DefaultResourceNamePrefix = "test-acc" // DefaultRandomSuffixLength is the default length of the random suffix used in acceptance tests. - DefaultRandomSuffixLength = 10 + DefaultRandomSuffixLength = 6 ) func RandStr() string { diff --git a/internal/schemautil/custom_diff.go b/internal/schemautil/custom_diff.go index 14711b816..2cbb796dd 100644 --- a/internal/schemautil/custom_diff.go +++ b/internal/schemautil/custom_diff.go @@ -62,7 +62,7 @@ func ShouldNotBeEmpty(_ context.Context, _, newValue, _ interface{}) bool { } func CustomizeDiffServiceIntegrationAfterCreation(_ context.Context, d *schema.ResourceDiff, _ interface{}) error { - if len(d.Id()) > 0 && d.HasChange("service_integrations") && len(d.Get("service_integrations").([]interface{})) != 0 { + if len(d.Id()) > 0 && d.HasChange("service_integrations") && len(d.Get("service_integrations").(*schema.Set).List()) != 0 { return fmt.Errorf("service_integrations field can only be set during creation of a service") } return nil diff --git a/internal/schemautil/helpers.go b/internal/schemautil/helpers.go index 8bc93a794..0ece353a7 100644 --- a/internal/schemautil/helpers.go +++ b/internal/schemautil/helpers.go @@ -10,6 +10,7 @@ import ( "github.com/docker/go-units" "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) // ResourceStateOrResourceDiff either *schema.ResourceState or *schema.ResourceDiff @@ -32,22 +33,19 @@ type PlanParameters struct { } func GetAPIServiceIntegrations(d ResourceStateOrResourceDiff) []service.ServiceIntegrationIn { - var apiServiceIntegrations []service.ServiceIntegrationIn - tfServiceIntegrations := d.Get("service_integrations") - if tfServiceIntegrations != nil { - tfServiceIntegrationList := tfServiceIntegrations.([]interface{}) - for _, definition := range tfServiceIntegrationList { - definitionMap := definition.(map[string]interface{}) - sourceService := definitionMap["source_service_name"].(string) - userConfig := make(map[string]any) - integrationType := definitionMap["integration_type"].(string) - apiIntegration := service.ServiceIntegrationIn{ - IntegrationType: service.IntegrationType(integrationType), - SourceService: &sourceService, - UserConfig: &userConfig, - } - apiServiceIntegrations = append(apiServiceIntegrations, apiIntegration) + tfServiceIntegrations := d.Get("service_integrations").(*schema.Set).List() + apiServiceIntegrations := make([]service.ServiceIntegrationIn, 0, len(tfServiceIntegrations)) + for _, definition := range tfServiceIntegrations { + definitionMap := definition.(map[string]interface{}) + sourceService := definitionMap["source_service_name"].(string) + userConfig := make(map[string]any) + integrationType := definitionMap["integration_type"].(string) + apiIntegration := service.ServiceIntegrationIn{ + IntegrationType: service.IntegrationType(integrationType), + SourceService: &sourceService, + UserConfig: &userConfig, } + apiServiceIntegrations = append(apiServiceIntegrations, apiIntegration) } return apiServiceIntegrations } diff --git a/internal/schemautil/schemautil.go b/internal/schemautil/schemautil.go index e8991ebcc..5f116c3a6 100644 --- a/internal/schemautil/schemautil.go +++ b/internal/schemautil/schemautil.go @@ -74,24 +74,6 @@ func ToOptionalString(val interface{}) string { } } -func ParseOptionalStringToInt64(val interface{}) *int64 { - v, ok := val.(string) - if !ok { - return nil - } - - if v == "" { - return nil - } - - res, err := strconv.ParseInt(v, 10, 64) - if err != nil { - return nil - } - - return &res -} - func CreateOnlyDiffSuppressFunc(_, _, _ string, d *schema.ResourceData) bool { return len(d.Id()) > 0 } @@ -264,7 +246,7 @@ func SplitResourceID4(resourceID string) (string, string, string, string, error) return parts[0], parts[1], parts[2], parts[3], nil } -func FlattenToString(a []interface{}) []string { +func FlattenToString[T any](a []T) []string { r := make([]string, len(a)) for i, v := range a { r[i] = fmt.Sprint(v) diff --git a/internal/schemautil/service.go b/internal/schemautil/service.go index 45609cbee..337f827bd 100644 --- a/internal/schemautil/service.go +++ b/internal/schemautil/service.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "net/http" + "slices" "strconv" "strings" "time" @@ -21,6 +22,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/aiven/terraform-provider-aiven/internal/common" + "github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig" "github.com/aiven/terraform-provider-aiven/internal/sdkprovider/userconfig/converters" ) @@ -72,9 +74,39 @@ var TechEmailsResourceSchema = &schema.Resource{ func ServiceCommonSchemaWithUserConfig(kind string) map[string]*schema.Schema { s := ServiceCommonSchema() converters.SetUserConfig(converters.ServiceUserConfig, kind, s) + + // Assigns the integration types that are allowed to be set when creating a service + integrations := getBootstrapIntegrationTypes(kind) + integrationType := s["service_integrations"].Elem.(*schema.Resource).Schema["integration_type"] + switch len(integrations) { + case 0: + // Disables the service integrations field if there are no integrations supported + integrationType.ValidateFunc = func(v any, _ string) ([]string, []error) { + return nil, []error{fmt.Errorf("service integration %s can't be specified here", v)} + } + default: + integrationType.Description = userconfig.Desc(integrationType.Description).PossibleValuesString(FlattenToString(integrations)...).Build() + integrationType.ValidateFunc = validation.StringInSlice(FlattenToString(integrations), false) + } + return s } +// getBootstrapIntegrationTypes returns the integration types that are allowed to be set when creating a service. +func getBootstrapIntegrationTypes(kind string) []service.IntegrationType { + list := make([]service.IntegrationType, 0) + switch kind { + case ServiceTypeMySQL, ServiceTypePG, ServiceTypeAlloyDBOmni: + list = append(list, service.IntegrationTypeReadReplica) + } + + if kind == ServiceTypePG { + list = append(list, service.IntegrationTypeDisasterRecovery) + } + + return list +} + func ServiceCommonSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "project": CommonSchemaProjectReference, @@ -209,7 +241,7 @@ func ServiceCommonSchema() map[string]*schema.Schema { Description: "Service state. One of `POWEROFF`, `REBALANCING`, `REBUILDING` or `RUNNING`", }, "service_integrations": { - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Computed: true, Description: "Service integrations to specify when creating a service. Not applied after initial service creation", @@ -223,7 +255,7 @@ func ServiceCommonSchema() map[string]*schema.Schema { "integration_type": { Type: schema.TypeString, Required: true, - Description: "Type of the service integration. The only supported value at the moment is `read_replica`", + Description: "Type of the service integration", }, }, }, @@ -522,7 +554,7 @@ func ResourceServiceUpdate(ctx context.Context, d *schema.ResourceData, m interf return nil } - if len(getIntegrationsForTerraform(s.ServiceIntegrations, service.IntegrationTypeAutoscaler)) == 0 { + if len(flattenIntegrations(s.ServiceIntegrations, service.IntegrationTypeAutoscaler)) == 0 { diskSpace, err := getDiskSpaceFromStateOrDiff(ctx, d, client) if err != nil { return diag.Errorf("error getting default disc space: %s", err) @@ -615,18 +647,22 @@ func getTechnicalEmailsForTerraform(s *service.ServiceGetOut) *schema.Set { return schema.NewSet(schema.HashResource(TechEmailsResourceSchema), techEmails) } -func getIntegrationsForTerraform(integrations []service.ServiceIntegrationOut, integrationType service.IntegrationType) []map[string]interface{} { - var filteredIntegrations []map[string]interface{} - for _, integration := range integrations { - if integration.IntegrationType == integrationType { - integrationMap := map[string]interface{}{ - "integration_type": integration.IntegrationType, - "source_service_name": integration.SourceService, - } - filteredIntegrations = append(filteredIntegrations, integrationMap) +// flattenIntegrations converts the service integrations into a list of maps +func flattenIntegrations(integrations []service.ServiceIntegrationOut, kinds ...service.IntegrationType) []map[string]interface{} { + result := make([]map[string]any, 0) + if len(integrations) == 0 || len(kinds) == 0 { + return result + } + + for _, v := range integrations { + if slices.Contains(kinds, v.IntegrationType) { + result = append(result, map[string]any{ + "integration_type": v.IntegrationType, + "source_service_name": v.SourceService, + }) } } - return filteredIntegrations + return result } func ResourceServiceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { @@ -777,9 +813,9 @@ func copyServicePropertiesFromAPIResponseToTerraform( return fmt.Errorf("cannot set `components` : %w", err) } - // Handle read_replica service integrations - readReplicaIntegrations := getIntegrationsForTerraform(s.ServiceIntegrations, service.IntegrationTypeReadReplica) - if err := d.Set("service_integrations", readReplicaIntegrations); err != nil { + // Handle service integrations + integrations := flattenIntegrations(s.ServiceIntegrations, getBootstrapIntegrationTypes(serviceType)...) + if err := d.Set("service_integrations", integrations); err != nil { return err } diff --git a/internal/schemautil/userconfig/desc.go b/internal/schemautil/userconfig/desc.go index f1387c4de..d84fa9ceb 100644 --- a/internal/schemautil/userconfig/desc.go +++ b/internal/schemautil/userconfig/desc.go @@ -13,7 +13,7 @@ const ( Resource EntityType = iota // DataSource is a constant that represents the data source entity type. DataSource - PossibleValuesPrefix = "The possible values are " + PossibleValuesPrefix = "The possible value" ) // String is a function that returns the string representation of the entity type. @@ -164,6 +164,11 @@ the ` + "`PROVIDER_AIVEN_ENABLE_BETA`" + ` environment variable to use the %[1]s if db.withPossibleValues != nil { builder.WriteRune(' ') builder.WriteString(PossibleValuesPrefix) + if len(db.withPossibleValues) == 1 { + builder.WriteString(" is ") + } else { + builder.WriteString("s are ") + } for i, value := range db.withPossibleValues { if i > 0 { if i == len(db.withPossibleValues)-1 { diff --git a/internal/schemautil/wait.go b/internal/schemautil/wait.go index 9b4884358..408192c30 100644 --- a/internal/schemautil/wait.go +++ b/internal/schemautil/wait.go @@ -15,6 +15,7 @@ import ( retryGo "github.com/avast/retry-go" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/samber/lo" "github.com/aiven/terraform-provider-aiven/internal/common" ) @@ -258,8 +259,13 @@ func backupsReady(s *service.ServiceGetOut) bool { // No backups for read replicas type of service // See https://github.com/aiven/terraform-provider-aiven/pull/172 for _, i := range s.ServiceIntegrations { - if i.IntegrationType == "read_replica" && *i.DestService == s.ServiceName { - return true + switch i.IntegrationType { + case service.IntegrationTypeReadReplica, service.IntegrationTypeDisasterRecovery: + // fixme: disaster recovery will have a backup eventually, + // remove this when BE is ready + if lo.FromPtr(i.DestService) == s.ServiceName { + return true + } } } diff --git a/internal/sdkprovider/service/clickhouse/clickhouse.go b/internal/sdkprovider/service/clickhouse/clickhouse.go index 1c8fca371..9bade86c3 100644 --- a/internal/sdkprovider/service/clickhouse/clickhouse.go +++ b/internal/sdkprovider/service/clickhouse/clickhouse.go @@ -31,26 +31,6 @@ func clickhouseSchema() map[string]*schema.Schema { }, }, } - s["service_integrations"] = &schema.Schema{ - Type: schema.TypeList, - Optional: true, - Description: "Integrations with other services. Service integrations are only applied at service creation.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "source_service_name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the source service.", - }, - "integration_type": { - Type: schema.TypeString, - Required: true, - Description: "Type of the service integration. Supported integrations are `clickhouse_kafka` and `clickhouse_postgresql`.", - }, - }, - }, - } - return s } diff --git a/internal/sdkprovider/service/pg/pg_test.go b/internal/sdkprovider/service/pg/pg_test.go index 13290a95b..782f80dd5 100644 --- a/internal/sdkprovider/service/pg/pg_test.go +++ b/internal/sdkprovider/service/pg/pg_test.go @@ -1088,3 +1088,58 @@ func testAccCheckAivenServicePGAttributes(n string) resource.TestCheckFunc { return nil } } + +func TestAccAivenServicePG_disaster_recovery(t *testing.T) { + primaryName := "aiven_pg.primary" + secondaryName := "aiven_pg.secondary" + projectName := os.Getenv("AIVEN_PROJECT_NAME") + randStr := acc.RandStr() + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + ProtoV6ProviderFactories: acc.TestProtoV6ProviderFactories, + CheckDestroy: acc.TestAccCheckAivenServiceResourceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccPGServiceResourceDisasterRecovery(projectName, randStr), + Check: resource.ComposeTestCheckFunc( + acc.TestAccCheckAivenServiceCommonAttributes(primaryName), + acc.TestAccCheckAivenServiceCommonAttributes(secondaryName), + // One service integration should be created + resource.TestCheckResourceAttr(secondaryName, "service_integrations.#", "1"), + // Which is of type disaster_recovery + resource.TestCheckTypeSetElemNestedAttrs(secondaryName, "service_integrations.*", map[string]string{ + "integration_type": "disaster_recovery", + "source_service_name": "test-acc-primary-" + randStr, + }), + ), + }, + }, + }) +} + +func testAccPGServiceResourceDisasterRecovery(project, randStr string) string { + return fmt.Sprintf(` +resource "aiven_pg" "primary" { + project = "%[1]s" + cloud_name = "google-europe-west1" + plan = "startup-4" + service_name = "test-acc-primary-%[2]s" + maintenance_window_dow = "monday" + maintenance_window_time = "10:00:00" +} + +resource "aiven_pg" "secondary" { + project = aiven_pg.primary.project + cloud_name = "google-europe-west1" + plan = "startup-4" + service_name = "test-acc-secondary-%[2]s" + maintenance_window_dow = "monday" + maintenance_window_time = "10:00:00" + + service_integrations { + integration_type = "disaster_recovery" + source_service_name = "test-acc-primary-%[2]s" + } +} +`, project, randStr) +}