From 08aa0ef8606ce8a33732e10e42c776f2ba8020c4 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 18 Oct 2023 10:58:41 +0100 Subject: [PATCH 01/12] ci: Prepare for the 0.6.1 release. (#371) * ci: Prepare for the 0.6.1 release. * docs: updated docs BigAnimal cloud account --- .goreleaser.yml | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 43c92bf4..b3e7a72a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -55,6 +55,6 @@ release: - glob: 'terraform-registry-manifest.json' name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' # If you want to manually examine the release before its live, uncomment this line: - draft: true + draft: false changelog: skip: true diff --git a/CHANGELOG.md b/CHANGELOG.md index ef284079..ff031fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## v0.6.1 (September 19. 2023) Features: -* BigAnimal Terraform Provider now supports BigAnimal Hosted(BAH) AWS, Azure and Google Cloud provider for `biganimal_cluster` and `biganimal_pgd` resources +* BigAnimal Terraform Provider now supports BigAnimal's cloud account AWS, Azure and Google Cloud provider for `biganimal_cluster` and `biganimal_pgd` resources * Custom maintenance window support for `biganimal_cluster` resources * Custom maintenance window support for the Witness groups in the `biganimal_pgd` resources From 5b7be16c055ba457d0f84ee2373936d6b070a720 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:19:45 +0100 Subject: [PATCH 02/12] docs: update release date for 0.6.1 (#374) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff031fc6..9b1b32f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## v0.6.1 (September 19. 2023) +## v0.6.1 (October 18. 2023) Features: * BigAnimal Terraform Provider now supports BigAnimal's cloud account AWS, Azure and Google Cloud provider for `biganimal_cluster` and `biganimal_pgd` resources * Custom maintenance window support for `biganimal_cluster` resources From 400e7f95297b1bc11ba4d156489126b7a6b0f2e2 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:51:41 +0000 Subject: [PATCH 03/12] fix: improved dg warnings to show which dg and their region has the warning (#376) --- pkg/plan_modifier/data_group_custom_diff.go | 62 +++++++++++++-------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/pkg/plan_modifier/data_group_custom_diff.go b/pkg/plan_modifier/data_group_custom_diff.go index 08166132..4683d6b1 100644 --- a/pkg/plan_modifier/data_group_custom_diff.go +++ b/pkg/plan_modifier/data_group_custom_diff.go @@ -146,10 +146,12 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan return } var stateDgKey *int + var stateDgRegion string for k := range stateDgs { if stateDgs[k].(basetypes.ObjectValue).Attributes()["region"].Equal(planDg.(basetypes.ObjectValue).Attributes()["region"]) { k := k stateDgKey = &k + stateDgRegion = stateDgs[k].(basetypes.ObjectValue).Attributes()["region"].String() break } } @@ -166,9 +168,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateAllowedIps := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["allowed_ip_ranges"] if !planAllowedIps.Equal(stateAllowedIps) { - resp.Diagnostics.AddWarning("Allowed IP ranges changed", fmt.Sprintf("Allowed IP ranges have changed from %v to %v", + resp.Diagnostics.AddWarning("Allowed IP ranges changed", fmt.Sprintf("Allowed IP ranges have changed from %v to %v for data group with region %v", stateAllowedIps, - planAllowedIps)) + planAllowedIps, + stateDgRegion)) } // backup retention period @@ -176,9 +179,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateBackupRetention := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["backup_retention_period"] if !planBackupRetention.Equal(stateBackupRetention) { - resp.Diagnostics.AddWarning("Backup retention changed", fmt.Sprintf("backup retention period has changed from %v to %v", + resp.Diagnostics.AddWarning("Backup retention changed", fmt.Sprintf("backup retention period has changed from %v to %v for data group with region %v", stateBackupRetention, - planBackupRetention)) + planBackupRetention, + stateDgRegion)) } // cluster architecture @@ -194,9 +198,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan sArchNodes := stateArch.(basetypes.ObjectValue).Attributes()["nodes"] if !pArchId.Equal(sArchId) || !pArchWitnessNodes.Equal(sArchWitnessNodes) || !pArchNodes.Equal(sArchNodes) { - resp.Diagnostics.AddWarning("Cluster architecture changed", fmt.Sprintf("Cluster architecture changed from %v to %v", + resp.Diagnostics.AddWarning("Cluster architecture changed", fmt.Sprintf("Cluster architecture changed from %v to %v for data group with region %v", stateArch, - planArch)) + planArch, + stateDgRegion)) } // csp auth @@ -204,9 +209,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateCspAuth := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["csp_auth"] if !planCspAuth.Equal(stateCspAuth) { - resp.Diagnostics.AddWarning("CSP auth changed", fmt.Sprintf("CSP auth changed from %v to %v", + resp.Diagnostics.AddWarning("CSP auth changed", fmt.Sprintf("CSP auth changed from %v to %v for data group with region %v", stateCspAuth, - planCspAuth)) + planCspAuth, + stateDgRegion)) } // instance type @@ -214,9 +220,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateInstanceType := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["instance_type"] if !planInstanceType.Equal(stateInstanceType) { - resp.Diagnostics.AddWarning("Instance type changed", fmt.Sprintf("Instance type changed from %v to %v", + resp.Diagnostics.AddWarning("Instance type changed", fmt.Sprintf("Instance type changed from %v to %v for data group with region %v", stateInstanceType, - planInstanceType)) + planInstanceType, + stateDgRegion)) } // storage @@ -232,9 +239,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan sStorageSize := stateStorage.(basetypes.ObjectValue).Attributes()["size"] if !pStorageType.Equal(sStorageType) || !pStorageProperties.Equal(sStorageProperties) || !pStorageSize.Equal(sStorageSize) { - resp.Diagnostics.AddWarning("Storage changed", fmt.Sprintf("Storage changed from %v to %v", + resp.Diagnostics.AddWarning("Storage changed", fmt.Sprintf("Storage changed from %v to %v for data group with region %v", stateStorage, - planStorage)) + planStorage, + stateDgRegion)) } // pg type @@ -243,9 +251,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan if !planPGType.Equal(statePGType) { resp.Diagnostics.AddError("PG type cannot be changed", - fmt.Sprintf("PG type cannot be changed. PG type changed from expected value %v to %v in config", + fmt.Sprintf("PG type cannot be changed. PG type changed from expected value %v to %v in config for data group with region %v", statePGType, - planPGType)) + planPGType, + stateDgRegion)) return } @@ -255,9 +264,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan if !planPGVersion.Equal(statePGVersion) { resp.Diagnostics.AddError("PG version cannot be changed", - fmt.Sprintf("PG version cannot be changed. PG version changed from expected value %v to %v in config", + fmt.Sprintf("PG version cannot be changed. PG version changed from expected value %v to %v in config for data group with region %v", statePGVersion, - planPGVersion)) + planPGVersion, + stateDgRegion)) return } @@ -266,9 +276,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateNetworking := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["private_networking"] if !planNetworking.Equal(stateNetworking) { - resp.Diagnostics.AddWarning("Private networking changed", fmt.Sprintf("Private networking changed from %v to %v", + resp.Diagnostics.AddWarning("Private networking changed", fmt.Sprintf("Private networking changed from %v to %v for data group with region %v", stateNetworking, - planNetworking)) + planNetworking, + stateDgRegion)) } // cloud provider @@ -277,9 +288,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan if !planCloudProvider.Equal(stateCloudProvider) { resp.Diagnostics.AddError("Cloud provider cannot be changed", - fmt.Sprintf("Cloud provider cannot be changed. Cloud provider changed from expected value: %v to %v in config", + fmt.Sprintf("Cloud provider cannot be changed. Cloud provider changed from expected value: %v to %v in config for data group with region %v", stateCloudProvider, - planCloudProvider)) + planCloudProvider, + stateDgRegion)) return } @@ -288,9 +300,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateRegion := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["region"] if !planRegion.Equal(stateRegion) { - resp.Diagnostics.AddWarning("Region changed", fmt.Sprintf("Region changed from %v to %v", + resp.Diagnostics.AddWarning("Region changed", fmt.Sprintf("Region changed from %v to %v for data group with region %v", stateRegion, - planRegion)) + planRegion, + stateDgRegion)) } // maintenance window @@ -298,9 +311,10 @@ func (m CustomDataGroupDiffModifier) PlanModifySet(ctx context.Context, req plan stateMw := stateDgs[*stateDgKey].(basetypes.ObjectValue).Attributes()["maintenance_window"] if !planMW.Equal(stateMw) { - resp.Diagnostics.AddWarning("Maintenance window changed", fmt.Sprintf("Maintenance window changed from %v to %v", + resp.Diagnostics.AddWarning("Maintenance window changed", fmt.Sprintf("Maintenance window changed from %v to %v for data group with region %v", stateMw, - planMW)) + planMW, + stateDgRegion)) } } From f897b77435478514682b9c08cc877fe9b5cd7fd5 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:50:18 +0000 Subject: [PATCH 04/12] test: fix and improve acceptance tests (#390) --- pkg/provider/resource_cluster.go | 1 + pkg/provider/resource_cluster_test.go | 4 ++++ pkg/provider/resource_pgd_test.go | 22 +++++++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index ae3571e8..a5daf8cf 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -206,6 +206,7 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest }, "name": schema.StringAttribute{ MarkdownDescription: "Name.", + Optional: true, Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, }, diff --git a/pkg/provider/resource_cluster_test.go b/pkg/provider/resource_cluster_test.go index 56e38a7e..cc80d2d7 100644 --- a/pkg/provider/resource_cluster_test.go +++ b/pkg/provider/resource_cluster_test.go @@ -50,6 +50,7 @@ func TestAccResourceCluster_basic(t *testing.T) { resource.TestCheckResourceAttr("biganimal_cluster.acctest_cluster", "backup_retention_period", "10d"), resource.TestCheckResourceAttr("biganimal_cluster.acctest_cluster", "cluster_architecture.id", "ha"), resource.TestCheckResourceAttr("biganimal_cluster.acctest_cluster", "cluster_architecture.nodes", "2"), + resource.TestCheckResourceAttr("biganimal_cluster.acctest_cluster", "cluster_architecture.name", "Primary/Standby High Availability"), ), }, }, @@ -103,6 +104,7 @@ func clusterResourceConfig(cluster_name, projectID, provider, region string) str pg_version = "15" private_networking = false read_only_connections = false + superuser_access = true }`, cluster_name, projectID, provider, region) } @@ -118,6 +120,7 @@ func clusterResourceConfigForUpdate(cluster_name, projectID, provider, region st cluster_architecture { id = "ha" nodes = 2 + name = "Primary/Standby High Availability" } csp_auth = true @@ -153,5 +156,6 @@ func clusterResourceConfigForUpdate(cluster_name, projectID, provider, region st pg_version = "15" private_networking = false read_only_connections = false + superuser_access = true }`, cluster_name, projectID, provider, region) } diff --git a/pkg/provider/resource_pgd_test.go b/pkg/provider/resource_pgd_test.go index 6ea3143f..de86d676 100644 --- a/pkg/provider/resource_pgd_test.go +++ b/pkg/provider/resource_pgd_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "testing" + "time" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -12,10 +13,13 @@ func TestAccResourcePGD_basic(t *testing.T) { var ( acc_env_vars_checklist = []string{ "BA_TF_ACC_VAR_pgd_project_id", - "BA_TF_ACC_VAR_pgd_name", + "BA_TF_ACC_VAR_pgd_region_dg1", + "BA_TF_ACC_VAR_pgd_provider_dg1", } - accPGDName = os.Getenv("BA_TF_ACC_VAR_pgd_name") - accProjectID = os.Getenv("BA_TF_ACC_VAR_pgd_project_id") + accPgdClusterName = fmt.Sprintf("acctest_pgd_cluster_basic_%v", time.Now().Unix()) + accProjectID = os.Getenv("BA_TF_ACC_VAR_pgd_project_id") + accRegionDg1 = os.Getenv("BA_TF_ACC_VAR_pgd_region_dg1") + accProviderDg1 = os.Getenv("BA_TF_ACC_VAR_pgd_provider_dg1") ) resource.Test(t, resource.TestCase{ @@ -26,10 +30,10 @@ func TestAccResourcePGD_basic(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: pgdResourceConfig(accPGDName, accProjectID), + Config: pgdResourceConfig(accPgdClusterName, accProjectID, accProviderDg1, accRegionDg1), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("biganimal_pgd.acctest_pgd", "project_id", accProjectID), - resource.TestCheckResourceAttr("biganimal_pgd.acctest_pgd", "cluster_name", accPGDName), + resource.TestCheckResourceAttr("biganimal_pgd.acctest_pgd", "cluster_name", accPgdClusterName), resource.TestCheckResourceAttrSet("biganimal_pgd.acctest_pgd", "cluster_id"), ), }, @@ -37,7 +41,7 @@ func TestAccResourcePGD_basic(t *testing.T) { }) } -func pgdResourceConfig(cluster_name, projectID string) string { +func pgdResourceConfig(cluster_name, projectID, providerDg1, regionDg1 string) string { return fmt.Sprintf(`resource "biganimal_pgd" "acctest_pgd" { cluster_name = "%s" project_id = "%s" @@ -86,10 +90,10 @@ func pgdResourceConfig(cluster_name, projectID string) string { } private_networking = false cloud_provider = { - cloud_provider_id = "azure" + cloud_provider_id = "%s" } region = { - region_id = "northeurope" + region_id = "%s" } maintenance_window = { is_enabled = true @@ -98,5 +102,5 @@ func pgdResourceConfig(cluster_name, projectID string) string { } }, ] - }`, cluster_name, projectID) + }`, cluster_name, projectID, providerDg1, regionDg1) } From f0532cfa17808fa2ccddaa2f5f8f752880c1c575 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:50:34 +0000 Subject: [PATCH 05/12] docs: readme update of bah examples (#388) --- examples/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/README.md b/examples/README.md index da223c28..33590de7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -11,10 +11,11 @@ The document generation tool looks for files in the following locations by defau ## biganimal_cluster resource examples * [Single node cluster example](./resources/biganimal_cluster/single_node/resource.tf) * [Single node cluster example on AWS(Your Cloud Account)](./resources/biganimal_cluster/single_node/aws/resource.tf) + * [Single node cluster example on AWS(BigAnimal's Cloud Account)](./resources/biganimal_cluster/single_node/bah_aws/resource.tf) * [Single node cluster example on Azure(Your Cloud Account)](./resources/biganimal_cluster/single_node/azure/resource.tf) + * [Single node cluster example on Azure(BigAnimal's Cloud Account)](./resources/biganimal_cluster/single_node/bah_azure/resource.tf) * [Single node cluster example on Google Cloud(Your Cloud Account)](./resources/biganimal_cluster/single_node/gcp/resource.tf) - * [Single node cluster example on AWS(BigAnimal Hosted)](./resources/biganimal_cluster/single_node/bah_aws/resource.tf) - * [Single node cluster example on Google Cloud(BigAnimal Hosted)](./resources/biganimal_cluster/single_node/bah_gcp/resource.tf) + * [Single node cluster example on Google Cloud(BigAnimal's Cloud Account)](./resources/biganimal_cluster/single_node/bah_gcp/resource.tf) * [Primary/Standby High availability cluster example](./resources/biganimal_cluster/ha/resource.tf) * For Distributed High Availability cluster examples, please check [the biganimal_pgd resource examples below](#biganimal_pgd-resource-examples-for-managing-distributed-high-availability-clusters) @@ -23,7 +24,13 @@ The document generation tool looks for files in the following locations by defau * [PGD Azure One Data Group Example](./resources/biganimal_pgd/azure/data_group/resource.tf) * [PGD Azure Two Data Groups with One Witness Group Example](./resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf) +* [PGD Azure BigAnimal's cloud account One Data Group Example](./resources/biganimal_pgd/azure/bah_data_group/resource.tf) +* [PGD Azure BigAnimal's cloud account Two Data Groups with One Witness Group Example](./resources/biganimal_pgd/azure/bah_data_groups_with_witness_group/resource.tf) * [PGD AWS One Data Group Example](./resources/biganimal_pgd/aws/data_group/resource.tf) * [PGD AWS Two Data Groups with One Witness Group Example](./resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf) +* [PGD AWS BigAnimal's cloud account One Data Group Example](./resources/biganimal_pgd/aws/bah_data_group/resource.tf) +* [PGD AWS BigAnimal's cloud account Two Data Groups with One Witness Group Example](./resources/biganimal_pgd/aws/bah_data_groups_with_witness_group/resource.tf) * [PGD Google Cloud One Data Group Example](./resources/biganimal_pgd/gcp/data_group/resource.tf) * [PGD Google Cloud Two Data Groups with One Witness Group Example](./resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf) +* [PGD GCP BigAnimal's cloud account One Data Group Example](./resources/biganimal_pgd/gcp/bah_data_group/resource.tf) +* [PGD GCP BigAnimal's cloud account Two Data Groups with One Witness Group Example](./resources/biganimal_pgd/gcp/bah_data_groups_with_witness_group/resource.tf) From 2c6f30433482fb1babf4f55f6e8f61c93336fc68 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:00:03 +0000 Subject: [PATCH 06/12] feat: pgvector for pg clusters (#411) --- .../biganimal_cluster/data-source.tf | 4 ++++ .../biganimal_cluster/ha/resource.tf | 1 + .../single_node/aws/resource.tf | 1 + .../single_node/azure/resource.tf | 1 + .../single_node/bah_aws/resource.tf | 1 + .../single_node/bah_azure/resource.tf | 1 + .../single_node/bah_gcp/resource.tf | 1 + .../single_node/gcp/resource.tf | 1 + .../biganimal_cluster/single_node/resource.tf | 1 + pkg/models/cluster.go | 1 + pkg/models/cluster_extension.go | 6 ++++++ pkg/provider/data_source_cluster.go | 4 ++++ pkg/provider/resource_cluster.go | 20 +++++++++++++++++++ pkg/provider/resource_cluster_test.go | 2 ++ 14 files changed, 45 insertions(+) create mode 100644 pkg/models/cluster_extension.go diff --git a/examples/data-sources/biganimal_cluster/data-source.tf b/examples/data-sources/biganimal_cluster/data-source.tf index 9bbddfd3..035d86ac 100644 --- a/examples/data-sources/biganimal_cluster/data-source.tf +++ b/examples/data-sources/biganimal_cluster/data-source.tf @@ -101,6 +101,10 @@ output "superuser_access" { value = coalesce(data.biganimal_cluster.this.superuser_access, false) } +output "pgvector" { + value = coalesce(data.biganimal_cluster.this.pgvector, false) +} + output "faraway_replica_ids" { value = data.biganimal_cluster.this.faraway_replica_ids } diff --git a/examples/resources/biganimal_cluster/ha/resource.tf b/examples/resources/biganimal_cluster/ha/resource.tf index bfbb067e..d70137e4 100644 --- a/examples/resources/biganimal_cluster/ha/resource.tf +++ b/examples/resources/biganimal_cluster/ha/resource.tf @@ -78,6 +78,7 @@ resource "biganimal_cluster" "ha_cluster" { read_only_connections = true region = "us-east-1" superuser_access = true + pgvector = true } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/aws/resource.tf b/examples/resources/biganimal_cluster/single_node/aws/resource.tf index 60335a4b..cb251fa5 100644 --- a/examples/resources/biganimal_cluster/single_node/aws/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/aws/resource.tf @@ -79,6 +79,7 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "us-east-1" superuser_access = true + pgvector = true } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/azure/resource.tf b/examples/resources/biganimal_cluster/single_node/azure/resource.tf index 00a241e6..7254ac99 100644 --- a/examples/resources/biganimal_cluster/single_node/azure/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/azure/resource.tf @@ -79,6 +79,7 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "eastus2" superuser_access = true + pgvector = true } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf b/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf index 02aa6fe1..52bf3b4b 100644 --- a/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf @@ -77,6 +77,7 @@ resource "biganimal_cluster" "single_node_cluster" { cloud_provider = "bah:aws" read_only_connections = false region = "us-east-1" + pgvector = true } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf b/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf index 076136e3..de8e18d1 100644 --- a/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf @@ -78,6 +78,7 @@ resource "biganimal_cluster" "single_node_cluster" { cloud_provider = "bah:azure" read_only_connections = false region = "eastus2" + pgvector = true # pe_allowed_principal_ids = [ # # ex: "9334e5e6-7f47-aE61-5A4F-ee067daeEf4A" # ] diff --git a/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf b/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf index 339480a5..f4a45453 100644 --- a/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf @@ -71,6 +71,7 @@ resource "biganimal_cluster" "single_node_cluster" { cloud_provider = "bah:gcp" read_only_connections = false region = "europe-west1" + pgvector = true } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/gcp/resource.tf b/examples/resources/biganimal_cluster/single_node/gcp/resource.tf index 4098bd90..a25db34a 100644 --- a/examples/resources/biganimal_cluster/single_node/gcp/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/gcp/resource.tf @@ -79,6 +79,7 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "us-east1" superuser_access = true + pgvector = true } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/resource.tf b/examples/resources/biganimal_cluster/single_node/resource.tf index 00a241e6..7254ac99 100644 --- a/examples/resources/biganimal_cluster/single_node/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/resource.tf @@ -79,6 +79,7 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "eastus2" superuser_access = true + pgvector = true } output "password" { diff --git a/pkg/models/cluster.go b/pkg/models/cluster.go index 8b41293b..abcc429f 100644 --- a/pkg/models/cluster.go +++ b/pkg/models/cluster.go @@ -173,6 +173,7 @@ type Cluster struct { ServiceAccountIds *[]string `json:"serviceAccountIds,omitempty"` PeAllowedPrincipalIds *[]string `json:"peAllowedPrincipalIds,omitempty"` SuperuserAccess *bool `json:"superuserAccess,omitempty"` + Extensions *[]ClusterExtension `json:"extensions,omitempty"` } // IsHealthy checks to see if the cluster has the right condition 'biganimal.com/deployed' diff --git a/pkg/models/cluster_extension.go b/pkg/models/cluster_extension.go new file mode 100644 index 00000000..266fb574 --- /dev/null +++ b/pkg/models/cluster_extension.go @@ -0,0 +1,6 @@ +package models + +type ClusterExtension struct { + Enabled bool `json:"enabled"` + ExtensionId string `json:"extensionId"` +} diff --git a/pkg/provider/data_source_cluster.go b/pkg/provider/data_source_cluster.go index a828690e..2a95accb 100644 --- a/pkg/provider/data_source_cluster.go +++ b/pkg/provider/data_source_cluster.go @@ -336,6 +336,10 @@ func (c *clusterDataSource) Schema(ctx context.Context, req datasource.SchemaReq MarkdownDescription: "Is superuser access enabled.", Computed: true, }, + "pgvector": schema.BoolAttribute{ + MarkdownDescription: "Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres.", + Computed: true, + }, }, } } diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index a5daf8cf..12576983 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -69,6 +69,7 @@ type ClusterResourceModel struct { ServiceAccountIds types.Set `tfsdk:"service_account_ids"` PeAllowedPrincipalIds types.Set `tfsdk:"pe_allowed_principal_ids"` SuperuserAccess types.Bool `tfsdk:"superuser_access"` + Pgvector types.Bool `tfsdk:"pgvector"` Timeouts timeouts.Value `tfsdk:"timeouts"` } @@ -391,6 +392,12 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest Optional: true, Computed: true, }, + "pgvector": schema.BoolAttribute{ + MarkdownDescription: "Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()}, + }, }, } } @@ -581,6 +588,14 @@ func (c *clusterResource) read(ctx context.Context, clusterResource *ClusterReso clusterResource.FarawayReplicaIds = StringSliceToSet(cluster.FarawayReplicaIds) clusterResource.PrivateNetworking = types.BoolPointerValue(cluster.PrivateNetworking) clusterResource.SuperuserAccess = types.BoolPointerValue(cluster.SuperuserAccess) + if cluster.Extensions != nil { + for _, v := range *cluster.Extensions { + if v.Enabled && v.ExtensionId == "pgvector" { + clusterResource.Pgvector = types.BoolValue(true) + break + } + } + } if cluster.FirstRecoverabilityPointAt != nil { firstPointAt := cluster.FirstRecoverabilityPointAt.String() @@ -730,6 +745,11 @@ func generateGenericClusterModel(clusterResource ClusterResourceModel) models.Cl SuperuserAccess: clusterResource.SuperuserAccess.ValueBoolPointer(), } + cluster.Extensions = &[]models.ClusterExtension{} + if clusterResource.Pgvector.ValueBool() { + *cluster.Extensions = append(*cluster.Extensions, models.ClusterExtension{Enabled: true, ExtensionId: "pgvector"}) + } + allowedIpRanges := []models.AllowedIpRange{} for _, ipRange := range clusterResource.AllowedIpRanges { allowedIpRanges = append(allowedIpRanges, models.AllowedIpRange{ diff --git a/pkg/provider/resource_cluster_test.go b/pkg/provider/resource_cluster_test.go index cc80d2d7..36719534 100644 --- a/pkg/provider/resource_cluster_test.go +++ b/pkg/provider/resource_cluster_test.go @@ -105,6 +105,7 @@ func clusterResourceConfig(cluster_name, projectID, provider, region string) str private_networking = false read_only_connections = false superuser_access = true + pgvector = true }`, cluster_name, projectID, provider, region) } @@ -157,5 +158,6 @@ func clusterResourceConfigForUpdate(cluster_name, projectID, provider, region st private_networking = false read_only_connections = false superuser_access = true + pgvector = true }`, cluster_name, projectID, provider, region) } From 7f9a62b036ed465e3a77cd5586c443178dd52a7f Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:01:10 +0000 Subject: [PATCH 07/12] feat: output password for pgd (#413) --- docs/resources/pgd.md | 60 +++++++++++++++++++ .../aws/bah_data_group/resource.tf | 5 ++ .../resource.tf | 5 ++ .../biganimal_pgd/aws/data_group/resource.tf | 5 ++ .../resource.tf | 5 ++ .../azure/bah_data_group/resource.tf | 5 ++ .../resource.tf | 5 ++ .../azure/data_group/resource.tf | 5 ++ .../resource.tf | 5 ++ .../gcp/bah_data_group/resource.tf | 5 ++ .../resource.tf | 5 ++ .../biganimal_pgd/gcp/data_group/resource.tf | 5 ++ .../resource.tf | 5 ++ 13 files changed, 120 insertions(+) diff --git a/docs/resources/pgd.md b/docs/resources/pgd.md index 9f8643df..8ee6b31d 100644 --- a/docs/resources/pgd.md +++ b/docs/resources/pgd.md @@ -96,6 +96,11 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD Azure Two Data Groups with One Witness Group Example @@ -259,6 +264,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD Azure BigAnimal's cloud account One Data Group Example @@ -356,6 +366,11 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD Azure BigAnimal's cloud account Two Data Groups with One Witness Group Example @@ -525,6 +540,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD AWS One Data Group Example @@ -619,6 +639,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD AWS Two Data Groups with One Witness Group Example @@ -782,6 +807,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD AWS BigAnimal's cloud account One Data Group Example @@ -879,6 +909,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD AWS BigAnimal's cloud account Two Data Groups with One Witness Group Example @@ -1048,6 +1083,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD GCP One Data Group Example @@ -1142,6 +1182,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD GCP Two Data Groups with One Witness Group Example @@ -1305,6 +1350,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD GCP BigAnimal's cloud account One Data Group Example @@ -1406,6 +1456,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` ## PGD GCP BigAnimal's cloud account Two Data Groups with One Witness Group Example @@ -1583,6 +1638,11 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} ``` diff --git a/examples/resources/biganimal_pgd/aws/bah_data_group/resource.tf b/examples/resources/biganimal_pgd/aws/bah_data_group/resource.tf index c45e411f..906deb69 100644 --- a/examples/resources/biganimal_pgd/aws/bah_data_group/resource.tf +++ b/examples/resources/biganimal_pgd/aws/bah_data_group/resource.tf @@ -91,3 +91,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/aws/bah_data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/aws/bah_data_groups_with_witness_group/resource.tf index d1f32883..caeb2cca 100644 --- a/examples/resources/biganimal_pgd/aws/bah_data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/aws/bah_data_groups_with_witness_group/resource.tf @@ -163,3 +163,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/aws/data_group/resource.tf b/examples/resources/biganimal_pgd/aws/data_group/resource.tf index 15abd9e8..d4a14764 100644 --- a/examples/resources/biganimal_pgd/aws/data_group/resource.tf +++ b/examples/resources/biganimal_pgd/aws/data_group/resource.tf @@ -88,3 +88,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf index aee5360c..70e8f649 100644 --- a/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf @@ -157,3 +157,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/azure/bah_data_group/resource.tf b/examples/resources/biganimal_pgd/azure/bah_data_group/resource.tf index 03e724d4..5ba63a5d 100644 --- a/examples/resources/biganimal_pgd/azure/bah_data_group/resource.tf +++ b/examples/resources/biganimal_pgd/azure/bah_data_group/resource.tf @@ -91,3 +91,8 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/azure/bah_data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/azure/bah_data_groups_with_witness_group/resource.tf index f712c2d8..89897c64 100644 --- a/examples/resources/biganimal_pgd/azure/bah_data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/azure/bah_data_groups_with_witness_group/resource.tf @@ -163,3 +163,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/azure/data_group/resource.tf b/examples/resources/biganimal_pgd/azure/data_group/resource.tf index c6906f98..d67e51e4 100644 --- a/examples/resources/biganimal_pgd/azure/data_group/resource.tf +++ b/examples/resources/biganimal_pgd/azure/data_group/resource.tf @@ -88,3 +88,8 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf index 64bc5e0c..2d8bcb21 100644 --- a/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf @@ -157,3 +157,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/gcp/bah_data_group/resource.tf b/examples/resources/biganimal_pgd/gcp/bah_data_group/resource.tf index 1d1f8f04..9b8c3e3d 100644 --- a/examples/resources/biganimal_pgd/gcp/bah_data_group/resource.tf +++ b/examples/resources/biganimal_pgd/gcp/bah_data_group/resource.tf @@ -95,3 +95,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/gcp/bah_data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/gcp/bah_data_groups_with_witness_group/resource.tf index 1c260c75..4ca6671c 100644 --- a/examples/resources/biganimal_pgd/gcp/bah_data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/gcp/bah_data_groups_with_witness_group/resource.tf @@ -171,3 +171,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/gcp/data_group/resource.tf b/examples/resources/biganimal_pgd/gcp/data_group/resource.tf index c5ddcb99..3756e1c7 100644 --- a/examples/resources/biganimal_pgd/gcp/data_group/resource.tf +++ b/examples/resources/biganimal_pgd/gcp/data_group/resource.tf @@ -88,3 +88,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} diff --git a/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf index 54a77d75..8f956df4 100644 --- a/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf @@ -157,3 +157,8 @@ resource "biganimal_pgd" "pgd_cluster" { } ] } + +output "password" { + sensitive = true + value = resource.biganimal_pgd.pgd_cluster.password +} From b045931f7558ae0e3ae0f3e9ee947cac48f6fbdc Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 29 Nov 2023 12:41:13 +0000 Subject: [PATCH 08/12] feat: added from_deleted attribute to schema for cluster restore functionality (#401) --- pkg/provider/resource_cluster.go | 5 +++++ pkg/provider/resource_pgd.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index 12576983..d6b4cee4 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -69,6 +69,7 @@ type ClusterResourceModel struct { ServiceAccountIds types.Set `tfsdk:"service_account_ids"` PeAllowedPrincipalIds types.Set `tfsdk:"pe_allowed_principal_ids"` SuperuserAccess types.Bool `tfsdk:"superuser_access"` + FromDeleted *bool `tfsdk:"from_deleted"` Pgvector types.Bool `tfsdk:"pgvector"` Timeouts timeouts.Value `tfsdk:"timeouts"` @@ -392,6 +393,10 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest Optional: true, Computed: true, }, + "from_deleted": schema.BoolAttribute{ + Description: "For restoring a cluster. Specifies if the cluster you want to restore is deleted", + Optional: true, + }, "pgvector": schema.BoolAttribute{ MarkdownDescription: "Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres.", Optional: true, diff --git a/pkg/provider/resource_pgd.go b/pkg/provider/resource_pgd.go index cd50fbb4..fd441757 100644 --- a/pkg/provider/resource_pgd.go +++ b/pkg/provider/resource_pgd.go @@ -82,6 +82,10 @@ func PgdSchema(ctx context.Context) schema.Schema { Description: "Show the most recent cluster when there are multiple clusters with the same name", Optional: true, }, + "from_deleted": schema.BoolAttribute{ + Description: "For restoring a cluster. Specifies if the cluster you want to restore is deleted", + Optional: true, + }, "password": schema.StringAttribute{ Description: "Password for the user edb_admin. It must be 12 characters or more.", Required: true, @@ -606,6 +610,7 @@ type PGD struct { ClusterId *string `tfsdk:"cluster_id"` ClusterName *string `tfsdk:"cluster_name"` MostRecent *bool `tfsdk:"most_recent"` + FromDeleted *bool `tfsdk:"from_deleted"` Password *string `tfsdk:"password"` Timeouts timeouts.Value `tfsdk:"timeouts"` DataGroups []terraform.DataGroup `tfsdk:"data_groups"` From 2ee5f91471a17ae153810fc9ef2d1213e3c352b2 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:04:23 +0000 Subject: [PATCH 09/12] fix: pre-commit hook update to v3.13.0 (#437) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 960ff9f1..9675c6e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # pre-commit hook to verify commit messages are conventional commit compliant - repo: https://github.com/commitizen-tools/commitizen - rev: 3.2.1 + rev: v3.13.0 hooks: - id: commitizen stages: [commit-msg] From 1d0bcb95dc815be842893bb3c7c35c7dddc6523c Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:53:55 +0000 Subject: [PATCH 10/12] fix: concurrent map writes bug (#427) --- go.mod | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 94cc1200..bdacef7b 100644 --- a/go.mod +++ b/go.mod @@ -8,13 +8,13 @@ require ( github.com/h2non/gock v1.2.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-docs v0.16.0 - github.com/hashicorp/terraform-plugin-framework v1.3.5 + github.com/hashicorp/terraform-plugin-framework v1.4.2 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 - github.com/hashicorp/terraform-plugin-go v0.18.0 + github.com/hashicorp/terraform-plugin-go v0.19.0 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/hashicorp/terraform-plugin-mux v0.11.2 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 + github.com/hashicorp/terraform-plugin-mux v0.12.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0 github.com/hashicorp/terraform-plugin-testing v1.4.0 github.com/joho/godotenv v1.5.1 github.com/kr/pretty v0.3.1 @@ -32,7 +32,7 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/Masterminds/sprig/v3 v3.2.2 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect @@ -40,26 +40,26 @@ require ( github.com/cloudflare/circl v1.3.3 // indirect github.com/fatih/color v1.15.0 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.5.0 // indirect + github.com/hashicorp/go-plugin v1.5.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.5.2 // indirect - github.com/hashicorp/hcl/v2 v2.18.0 // indirect + github.com/hashicorp/hc-install v0.6.1 // indirect + github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.18.1 // indirect + github.com/hashicorp/terraform-exec v0.19.0 // indirect github.com/hashicorp/terraform-json v0.17.1 // indirect github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.15 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/mitchellh/cli v1.1.5 // indirect @@ -75,16 +75,16 @@ require ( github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/zclconf/go-cty v1.14.0 // indirect - golang.org/x/crypto v0.12.0 // indirect + github.com/zclconf/go-cty v1.14.1 // indirect + golang.org/x/crypto v0.15.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect - golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.57.0 // indirect + google.golang.org/grpc v1.57.1 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) From 16cd83a97fd7ecb87fe9e2fe50824fe70ec9ea56 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:55:33 +0000 Subject: [PATCH 11/12] fix: private networking true allowed ip ranges bug fix (#436) --- pkg/plan_modifier/allowed_ips.go | 35 ++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/pkg/plan_modifier/allowed_ips.go b/pkg/plan_modifier/allowed_ips.go index c92e4ef8..cf4fa07b 100644 --- a/pkg/plan_modifier/allowed_ips.go +++ b/pkg/plan_modifier/allowed_ips.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" ) func CustomAllowedIps() planmodifier.Set { @@ -27,16 +28,42 @@ func (m customAllowedIpsModifier) MarkdownDescription(_ context.Context) string // PlanModifySet implements the plan modification logic. func (m customAllowedIpsModifier) PlanModifySet(ctx context.Context, req planmodifier.SetRequest, resp *planmodifier.SetResponse) { - if len(resp.PlanValue.Elements()) == 0 { - // if plan value is [] the api will return 0.0.0.0/0 - defaultAttrs := map[string]attr.Value{"cidr_block": basetypes.NewStringValue("0.0.0.0/0"), "description": basetypes.NewStringValue("")} + var planObject map[string]tftypes.Value + + err := req.Plan.Raw.As(&planObject) + if err != nil { + resp.Diagnostics.AddError("Mapping plan object in allowed ip ranges plan modifier error", err.Error()) + return + } + + var privateNetworking bool + err = planObject["private_networking"].As(&privateNetworking) + if err != nil { + resp.Diagnostics.AddError("Mapping private networking object in allowed ip ranges plan modifier error", err.Error()) + return + } + + allowedIpRangesSetValueFunc := func(description string) basetypes.SetValue { + defaultAttrs := map[string]attr.Value{"cidr_block": basetypes.NewStringValue("0.0.0.0/0"), "description": basetypes.NewStringValue(description)} defaultAttrTypes := map[string]attr.Type{"cidr_block": defaultAttrs["cidr_block"].Type(ctx), "description": defaultAttrs["description"].Type(ctx)} defaultObjectValue := basetypes.NewObjectValueMust(defaultAttrTypes, defaultAttrs) setOfObjects := []attr.Value{} setOfObjects = append(setOfObjects, defaultObjectValue) setValue := basetypes.NewSetValueMust(defaultObjectValue.Type(ctx), setOfObjects) - resp.PlanValue = setValue + + return setValue + } + + // if private networking set allowed IP ranges to cidr_block:"0.0.0.0/0" description:"To allow all access" + if privateNetworking { + resp.PlanValue = allowedIpRangesSetValueFunc("To allow all access") + return + } + + // if allowed IP ranges plan value is [] set allowed IP ranges cidr_block:"0.0.0.0/0" description:"" + if len(resp.PlanValue.Elements()) == 0 { + resp.PlanValue = allowedIpRangesSetValueFunc("") return } From 55fc063e3e28a333ccf0de1fe27ba3465c6c5395 Mon Sep 17 00:00:00 2001 From: wai-wong-edb <119956756+wai-wong-edb@users.noreply.github.com> Date: Tue, 9 Jan 2024 13:03:13 +0000 Subject: [PATCH 12/12] feat: pg bouncer for pg clusters (#421) * feat: pg bouncer for pg clusters * docs: updated examples and docs * fix: plan modifier for pg bouncer * fix: terraform random update * feat: pg bouncer data source schema * fix: updated examples * docs: update docs * fix: pg bouncer operation validator * fix: comments and descriptions * fix: spell check * fix: go.sum dependencies * fix: dependencies update --- .wordlist-en-custom.txt | 2 + docs/data-sources/cluster.md | 28 ++++ docs/resources/cluster.md | 65 +++++++- .../biganimal_cluster/ha/resource.tf | 20 ++- .../single_node/aws/resource.tf | 20 ++- .../single_node/azure/resource.tf | 20 ++- .../single_node/bah_aws/resource.tf | 20 ++- .../single_node/bah_azure/resource.tf | 21 ++- .../single_node/bah_gcp/resource.tf | 18 ++- .../single_node/gcp/resource.tf | 20 ++- .../biganimal_cluster/single_node/resource.tf | 20 ++- go.mod | 28 ++-- go.sum | 149 ++++++++++-------- pkg/models/cluster.go | 1 + pkg/models/pg_bouncer.go | 6 + pkg/models/pg_bouncer_settings.go | 7 + pkg/plan_modifier/pg_bouncer.go | 53 +++++++ pkg/provider/data_source_cluster.go | 31 ++++ pkg/provider/resource_cluster.go | 85 ++++++++++ 19 files changed, 516 insertions(+), 98 deletions(-) create mode 100644 pkg/models/pg_bouncer.go create mode 100644 pkg/models/pg_bouncer_settings.go create mode 100644 pkg/plan_modifier/pg_bouncer.go diff --git a/.wordlist-en-custom.txt b/.wordlist-en-custom.txt index ce8d6750..f8e223f1 100644 --- a/.wordlist-en-custom.txt +++ b/.wordlist-en-custom.txt @@ -34,6 +34,8 @@ nestedblock nestedobjatt pgd pgextended +pgBouncer +pgvector postgres ssd terraform diff --git a/docs/data-sources/cluster.md b/docs/data-sources/cluster.md index 5b756e5b..ac3f3cc0 100644 --- a/docs/data-sources/cluster.md +++ b/docs/data-sources/cluster.md @@ -106,6 +106,10 @@ output "superuser_access" { value = coalesce(data.biganimal_cluster.this.superuser_access, false) } +output "pgvector" { + value = coalesce(data.biganimal_cluster.this.pgvector, false) +} + output "faraway_replica_ids" { value = data.biganimal_cluster.this.faraway_replica_ids } @@ -133,6 +137,7 @@ output "service_account_ids" { - `faraway_replica_ids` (Set of String) - `most_recent` (Boolean) Show the most recent cluster when there are multiple clusters with the same name. - `pe_allowed_principal_ids` (Set of String) +- `pg_bouncer` (Attributes) Pg bouncer. (see [below for nested schema](#nestedatt--pg_bouncer)) - `service_account_ids` (Set of String) ### Read-Only @@ -156,6 +161,7 @@ output "service_account_ids" { - `pg_config` (Attributes Set) Database configuration parameters. (see [below for nested schema](#nestedatt--pg_config)) - `pg_type` (String) Postgres type. - `pg_version` (String) Postgres version. +- `pgvector` (Boolean) Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres. - `phase` (String) Current phase of the cluster. - `private_networking` (Boolean) Is private networking enabled. - `read_only_connections` (Boolean) Is read only connection enabled. @@ -174,6 +180,28 @@ Read-Only: - `description` (String) CIDR block description. + +### Nested Schema for `pg_bouncer` + +Required: + +- `is_enabled` (Boolean) Is pg bouncer enabled. + +Optional: + +- `settings` (Attributes Set) PgBouncer Configuration Settings. (see [below for nested schema](#nestedatt--pg_bouncer--settings)) + + +### Nested Schema for `pg_bouncer.settings` + +Required: + +- `name` (String) Name. +- `operation` (String) Operation. +- `value` (String) Value. + + + ### Nested Schema for `cluster_architecture` diff --git a/docs/resources/cluster.md b/docs/resources/cluster.md index 754b07c4..a8107e1a 100644 --- a/docs/resources/cluster.md +++ b/docs/resources/cluster.md @@ -17,7 +17,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -90,6 +90,23 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "eastus2" superuser_access = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { @@ -112,7 +129,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -184,6 +201,23 @@ resource "biganimal_cluster" "ha_cluster" { read_only_connections = true region = "us-east-1" superuser_access = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { @@ -224,9 +258,12 @@ output "faraway_replica_ids" { - `backup_retention_period` (String) Backup retention period. For example, "7d", "2w", or "3m". - `cluster_architecture` (Block, Optional) Cluster architecture. See [Supported cluster types](https://www.enterprisedb.com/docs/biganimal/latest/overview/02_high_availability/) for details. (see [below for nested schema](#nestedblock--cluster_architecture)) - `csp_auth` (Boolean) Is authentication handled by the cloud service provider. Available for AWS only, See [Authentication](https://www.enterprisedb.com/docs/biganimal/latest/getting_started/creating_a_cluster/#authentication) for details. +- `from_deleted` (Boolean) For restoring a cluster. Specifies if the cluster you want to restore is deleted - `maintenance_window` (Attributes) Custom maintenance window. (see [below for nested schema](#nestedatt--maintenance_window)) - `pe_allowed_principal_ids` (Set of String) Cloud provider subscription/account ID, need to be specified when cluster is deployed on BigAnimal's cloud account. +- `pg_bouncer` (Attributes) Pg bouncer. (see [below for nested schema](#nestedatt--pg_bouncer)) - `pg_config` (Block Set) Database configuration parameters. See [Modifying database configuration parameters](https://www.enterprisedb.com/docs/biganimal/latest/using_cluster/03_modifying_your_cluster/05_db_configuration_parameters/) for details. (see [below for nested schema](#nestedblock--pg_config)) +- `pgvector` (Boolean) Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres. - `private_networking` (Boolean) Is private networking enabled. - `read_only_connections` (Boolean) Is read only connection enabled. - `service_account_ids` (Set of String) A Google Cloud Service Account is used for logs. If you leave this blank, then you will be unable to access log details for this cluster. Required when cluster is deployed on BigAnimal's cloud account. @@ -269,7 +306,7 @@ Required: - `id` (String) Cluster architecture ID. For example, "single" or "ha".For Extreme High Availability clusters, please use the [biganimal_pgd](https://registry.terraform.io/providers/EnterpriseDB/biganimal/latest/docs/resources/pgd) resource. - `nodes` (Number) Node count. -Read-Only: +Optional: - `name` (String) Name. @@ -287,6 +324,28 @@ Optional: - `start_time` (String) Start time. "hh:mm", for example: "23:59". + +### Nested Schema for `pg_bouncer` + +Required: + +- `is_enabled` (Boolean) Is pg bouncer enabled. + +Optional: + +- `settings` (Attributes Set) PgBouncer Configuration Settings. (see [below for nested schema](#nestedatt--pg_bouncer--settings)) + + +### Nested Schema for `pg_bouncer.settings` + +Required: + +- `name` (String) Name. +- `operation` (String) Operation. +- `value` (String) Value. + + + ### Nested Schema for `pg_config` diff --git a/examples/resources/biganimal_cluster/ha/resource.tf b/examples/resources/biganimal_cluster/ha/resource.tf index d70137e4..b7378287 100644 --- a/examples/resources/biganimal_cluster/ha/resource.tf +++ b/examples/resources/biganimal_cluster/ha/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -78,7 +78,23 @@ resource "biganimal_cluster" "ha_cluster" { read_only_connections = true region = "us-east-1" superuser_access = true - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/aws/resource.tf b/examples/resources/biganimal_cluster/single_node/aws/resource.tf index cb251fa5..fbb0f8d0 100644 --- a/examples/resources/biganimal_cluster/single_node/aws/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/aws/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -79,7 +79,23 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "us-east-1" superuser_access = true - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/azure/resource.tf b/examples/resources/biganimal_cluster/single_node/azure/resource.tf index 7254ac99..da8f7b18 100644 --- a/examples/resources/biganimal_cluster/single_node/azure/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/azure/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -79,7 +79,23 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "eastus2" superuser_access = true - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf b/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf index 52bf3b4b..d739a0af 100644 --- a/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/bah_aws/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -77,7 +77,23 @@ resource "biganimal_cluster" "single_node_cluster" { cloud_provider = "bah:aws" read_only_connections = false region = "us-east-1" - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf b/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf index de8e18d1..c80fd1b1 100644 --- a/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/bah_azure/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -78,7 +78,24 @@ resource "biganimal_cluster" "single_node_cluster" { cloud_provider = "bah:azure" read_only_connections = false region = "eastus2" - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } + # pe_allowed_principal_ids = [ # # ex: "9334e5e6-7f47-aE61-5A4F-ee067daeEf4A" # ] diff --git a/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf b/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf index f4a45453..a57a710c 100644 --- a/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/bah_gcp/resource.tf @@ -71,7 +71,23 @@ resource "biganimal_cluster" "single_node_cluster" { cloud_provider = "bah:gcp" read_only_connections = false region = "europe-west1" - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/gcp/resource.tf b/examples/resources/biganimal_cluster/single_node/gcp/resource.tf index a25db34a..cd75b557 100644 --- a/examples/resources/biganimal_cluster/single_node/gcp/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/gcp/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -79,7 +79,23 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "us-east1" superuser_access = true - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/examples/resources/biganimal_cluster/single_node/resource.tf b/examples/resources/biganimal_cluster/single_node/resource.tf index 7254ac99..da8f7b18 100644 --- a/examples/resources/biganimal_cluster/single_node/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/resource.tf @@ -6,7 +6,7 @@ terraform { } random = { source = "hashicorp/random" - version = "3.5.1" + version = "3.6.0" } } } @@ -79,7 +79,23 @@ resource "biganimal_cluster" "single_node_cluster" { read_only_connections = false region = "eastus2" superuser_access = true - pgvector = true + pgvector = false + + pg_bouncer = { + is_enabled = false + # settings = [ # If is_enabled is true, remove the comment and enter the settings. Should you prefer something different from the defaults. + # { + # name = "autodb_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "5000" + # }, + # { + # name = "client_idle_timeout" + # operation = "read-write" #valid values ["read-write", "read-only"]. "read-only" is only valid for ha clusters with read_only_connections set to true + # value = "6000" + # }, + # ] + } } output "password" { diff --git a/go.mod b/go.mod index bdacef7b..5b8e8a9d 100644 --- a/go.mod +++ b/go.mod @@ -11,10 +11,10 @@ require ( github.com/hashicorp/terraform-plugin-framework v1.4.2 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 - github.com/hashicorp/terraform-plugin-go v0.19.0 + github.com/hashicorp/terraform-plugin-go v0.20.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-mux v0.12.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 github.com/hashicorp/terraform-plugin-testing v1.4.0 github.com/joho/godotenv v1.5.1 github.com/kr/pretty v0.3.1 @@ -47,15 +47,15 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.5.1 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.6.1 // indirect + github.com/hashicorp/hc-install v0.6.2 // indirect github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.19.0 // indirect - github.com/hashicorp/terraform-json v0.17.1 // indirect - github.com/hashicorp/terraform-registry-address v0.2.2 // indirect + github.com/hashicorp/terraform-json v0.18.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect @@ -73,18 +73,18 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.14.1 // indirect - golang.org/x/crypto v0.15.0 // indirect + golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.57.1 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/grpc v1.60.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ea68025e..54c5f036 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= @@ -5,12 +7,10 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0 github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= -github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= -github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= -github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -25,11 +25,12 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -41,27 +42,29 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= -github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= -github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk= -github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git/v5 v5.10.1 h1:tu8/D8i+TWxgKpzQ3Vc43e+kkhXqtsZCKI/egajKnxk= +github.com/go-git/go-git/v5 v5.10.1/go.mod h1:uEuHjxkHap8kAl//V5F/nNWwqIYtP/402ddd05mp0wg= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -87,43 +90,43 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.5.0 h1:g6Lj3USwF5LaB8HlvCxPjN2X4nFE08ko2BJNVpl7TIE= -github.com/hashicorp/go-plugin v1.5.0/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.5.2 h1:SfwMFnEXVVirpwkDuSF5kymUOhrUxrTq3udEseZdOD0= -github.com/hashicorp/hc-install v0.5.2/go.mod h1:9QISwe6newMWIfEiXpzuu1k9HAGtQYgnSH8H9T8wmoI= -github.com/hashicorp/hcl/v2 v2.18.0 h1:wYnG7Lt31t2zYkcquwgKo6MWXzRUDIeIVU5naZwHLl8= -github.com/hashicorp/hcl/v2 v2.18.0/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= +github.com/hashicorp/hc-install v0.6.2 h1:V1k+Vraqz4olgZ9UzKiAcbman9i9scg9GgSt/U3mw/M= +github.com/hashicorp/hc-install v0.6.2/go.mod h1:2JBpd+NCFKiHiu/yYCGaPyPHhZLxXTpz8oreHa/a3Ps= +github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= +github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX5H8XZxHlH4= -github.com/hashicorp/terraform-exec v0.18.1/go.mod h1:58wg4IeuAJ6LVsLUeD2DWZZoc/bYi6dzhLHzxM41980= -github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= -github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= +github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM= +github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg= +github.com/hashicorp/terraform-json v0.18.0 h1:pCjgJEqqDESv4y0Tzdqfxr/edOIGkjs8keY42xfNBwU= +github.com/hashicorp/terraform-json v0.18.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= github.com/hashicorp/terraform-plugin-docs v0.16.0 h1:UmxFr3AScl6Wged84jndJIfFccGyBZn52KtMNsS12dI= github.com/hashicorp/terraform-plugin-docs v0.16.0/go.mod h1:M3ZrlKBJAbPMtNOPwHicGi1c+hZUh7/g0ifT/z7TVfA= -github.com/hashicorp/terraform-plugin-framework v1.3.5 h1:FJ6s3CVWVAxlhiF/jhy6hzs4AnPHiflsp9KgzTGl1wo= -github.com/hashicorp/terraform-plugin-framework v1.3.5/go.mod h1:2gGDpWiTI0irr9NSTLFAKlTi6KwGti3AoU19rFqU30o= +github.com/hashicorp/terraform-plugin-framework v1.4.2 h1:P7a7VP1GZbjc4rv921Xy5OckzhoiO3ig6SGxwelD2sI= +github.com/hashicorp/terraform-plugin-framework v1.4.2/go.mod h1:GWl3InPFZi2wVQmdVnINPKys09s9mLmTZr95/ngLnbY= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-go v0.18.0 h1:IwTkOS9cOW1ehLd/rG0y+u/TGLK9y6fGoBjXVUquzpE= -github.com/hashicorp/terraform-plugin-go v0.18.0/go.mod h1:l7VK+2u5Kf2y+A+742GX0ouLut3gttudmvMgN0PA74Y= +github.com/hashicorp/terraform-plugin-go v0.20.0 h1:oqvoUlL+2EUbKNsJbIt3zqqZ7wi6lzn4ufkn/UA51xQ= +github.com/hashicorp/terraform-plugin-go v0.20.0/go.mod h1:Rr8LBdMlY53a3Z/HpP+ZU3/xCDqtKNCkeI9qOyT10QE= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-mux v0.11.2 h1:XMkAmWQN+6F+l4jwNeqdPom/8Vly6ZNDxHoKjiRHx5c= -github.com/hashicorp/terraform-plugin-mux v0.11.2/go.mod h1:qjoF/pI49rILSNQzKIuDtU+ZX9mpQD0B8YNE1GceLPc= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 h1:gY4SG34ANc6ZSeWEKC9hDTChY0ZiN+Myon17fSA0Xgc= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0/go.mod h1:deXEw/iJXtJxNV9d1c/OVJrvL7Zh0a++v7rzokW6wVY= +github.com/hashicorp/terraform-plugin-mux v0.12.0 h1:TJlmeslQ11WlQtIFAfth0vXx+gSNgvMEng2Rn9z3WZY= +github.com/hashicorp/terraform-plugin-mux v0.12.0/go.mod h1:8MR0AgmV+Q03DIjyrAKxXyYlq2EUnYBQP8gxAAA0zeM= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0/go.mod h1:qH/34G25Ugdj5FcM95cSoXzUgIbgfhVLXCcEcYaMwq8= github.com/hashicorp/terraform-plugin-testing v1.4.0 h1:DVIXxw7VHZvnwWVik4HzhpC2yytaJ5FpiHxz5debKmE= github.com/hashicorp/terraform-plugin-testing v1.4.0/go.mod h1:b7Bha24iGrbZQjT+ZE8m9crck1YjdVOZ8mfGCQ19OxA= -github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= -github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= +github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= +github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= @@ -132,8 +135,8 @@ github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= @@ -205,8 +208,8 @@ github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNX github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= -github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= +github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= +github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= @@ -220,37 +223,43 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zclconf/go-cty v1.14.0 h1:/Xrd39K7DXbHzlisFP9c4pHao4yyf+/Ug9LEz+Y/yhc= -github.com/zclconf/go-cty v1.14.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= +github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -259,39 +268,48 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= @@ -305,7 +323,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= diff --git a/pkg/models/cluster.go b/pkg/models/cluster.go index abcc429f..d63191cf 100644 --- a/pkg/models/cluster.go +++ b/pkg/models/cluster.go @@ -174,6 +174,7 @@ type Cluster struct { PeAllowedPrincipalIds *[]string `json:"peAllowedPrincipalIds,omitempty"` SuperuserAccess *bool `json:"superuserAccess,omitempty"` Extensions *[]ClusterExtension `json:"extensions,omitempty"` + PgBouncer *PgBouncer `json:"pgBouncer,omitempty"` } // IsHealthy checks to see if the cluster has the right condition 'biganimal.com/deployed' diff --git a/pkg/models/pg_bouncer.go b/pkg/models/pg_bouncer.go new file mode 100644 index 00000000..6aa5eb93 --- /dev/null +++ b/pkg/models/pg_bouncer.go @@ -0,0 +1,6 @@ +package models + +type PgBouncer struct { + IsEnabled bool `json:"isEnabled"` + Settings *[]PgBouncerSettings `json:"settings,omitempty"` +} diff --git a/pkg/models/pg_bouncer_settings.go b/pkg/models/pg_bouncer_settings.go new file mode 100644 index 00000000..ae97ee1e --- /dev/null +++ b/pkg/models/pg_bouncer_settings.go @@ -0,0 +1,7 @@ +package models + +type PgBouncerSettings struct { + Name *string `json:"name,omitempty"` + Operation *string `json:"operation,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/pkg/plan_modifier/pg_bouncer.go b/pkg/plan_modifier/pg_bouncer.go new file mode 100644 index 00000000..295aeef7 --- /dev/null +++ b/pkg/plan_modifier/pg_bouncer.go @@ -0,0 +1,53 @@ +package plan_modifier + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" +) + +func CustomPgBouncer() planmodifier.Object { + return CustomPgBouncerModifier{} +} + +// CustomPgBouncerModifier implements the plan modifier. +type CustomPgBouncerModifier struct{} + +// Description returns a human-readable description of the plan modifier. +func (m CustomPgBouncerModifier) Description(_ context.Context) string { + return "Once set, the value of this attribute in state will not change." +} + +// MarkdownDescription returns a markdown description of the plan modifier. +func (m CustomPgBouncerModifier) MarkdownDescription(_ context.Context) string { + return "Once set, the value of this attribute in state will not change." +} + +// PlanModifyObject implements the plan modification logic. +func (m CustomPgBouncerModifier) PlanModifyObject(ctx context.Context, req planmodifier.ObjectRequest, resp *planmodifier.ObjectResponse) { + if req.PlanValue.IsUnknown() { + resp.PlanValue = basetypes.NewObjectValueMust( + req.StateValue.AttributeTypes(ctx), + map[string]attr.Value{ + "is_enabled": basetypes.NewBoolValue(false), + "settings": basetypes.NewSetNull(req.StateValue.AttributeTypes(ctx)["settings"].(types.SetType).ElemType), + }, + ) + return + } + + // Do nothing if there is a known planned value. + if !req.PlanValue.IsUnknown() { + return + } + + // Do nothing if there is an unknown configuration value, otherwise interpolation gets messed up. + if req.ConfigValue.IsUnknown() { + return + } + + resp.PlanValue = req.StateValue +} diff --git a/pkg/provider/data_source_cluster.go b/pkg/provider/data_source_cluster.go index 2a95accb..8b0a6425 100644 --- a/pkg/provider/data_source_cluster.go +++ b/pkg/provider/data_source_cluster.go @@ -340,6 +340,37 @@ func (c *clusterDataSource) Schema(ctx context.Context, req datasource.SchemaReq MarkdownDescription: "Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres.", Computed: true, }, + "pg_bouncer": schema.SingleNestedAttribute{ + MarkdownDescription: "Pg bouncer.", + Optional: true, + Computed: true, + Attributes: map[string]schema.Attribute{ + "is_enabled": schema.BoolAttribute{ + MarkdownDescription: "Is pg bouncer enabled.", + Required: true, + }, + "settings": schema.SetNestedAttribute{ + Description: "PgBouncer Configuration Settings.", + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "name": schema.StringAttribute{ + Description: "Name.", + Required: true, + }, + "operation": schema.StringAttribute{ + Description: "Operation.", + Required: true, + }, + "value": schema.StringAttribute{ + Description: "Value.", + Required: true, + }, + }, + }, + }, + }, + }, }, } } diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index d6b4cee4..485a5ae9 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -71,6 +71,7 @@ type ClusterResourceModel struct { SuperuserAccess types.Bool `tfsdk:"superuser_access"` FromDeleted *bool `tfsdk:"from_deleted"` Pgvector types.Bool `tfsdk:"pgvector"` + PgBouncer *PgBouncerModel `tfsdk:"pg_bouncer"` Timeouts timeouts.Value `tfsdk:"timeouts"` } @@ -99,6 +100,17 @@ type AllowedIpRangesResourceModel struct { Description types.String `tfsdk:"description"` } +type PgBouncerModel struct { + IsEnabled bool `tfsdk:"is_enabled"` + Settings *[]PgBouncerSettingsModel `tfsdk:"settings"` +} + +type PgBouncerSettingsModel struct { + Name string `tfsdk:"name"` + Operation string `tfsdk:"operation"` + Value string `tfsdk:"value"` +} + type clusterResource struct { client *api.ClusterClient } @@ -403,6 +415,43 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()}, }, + "pg_bouncer": schema.SingleNestedAttribute{ + MarkdownDescription: "Pg bouncer.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + plan_modifier.CustomPgBouncer(), + }, + Attributes: map[string]schema.Attribute{ + "is_enabled": schema.BoolAttribute{ + MarkdownDescription: "Is pg bouncer enabled.", + Required: true, + }, + "settings": schema.SetNestedAttribute{ + Description: "PgBouncer Configuration Settings.", + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "name": schema.StringAttribute{ + Description: "Name.", + Required: true, + }, + "operation": schema.StringAttribute{ + Description: "Operation.", + Required: true, + Validators: []validator.String{ + stringvalidator.OneOf("read-write", "read-only"), + }, + }, + "value": schema.StringAttribute{ + Description: "Value.", + Required: true, + }, + }, + }, + }, + }, + }, }, } } @@ -647,6 +696,24 @@ func (c *clusterResource) read(ctx context.Context, clusterResource *ClusterReso clusterResource.ServiceAccountIds = StringSliceToSet(utils.ToValue(&cluster.ServiceAccountIds)) } + if cluster.PgBouncer != nil { + clusterResource.PgBouncer = &PgBouncerModel{} + *clusterResource.PgBouncer = PgBouncerModel{ + IsEnabled: cluster.PgBouncer.IsEnabled, + } + + if cluster.PgBouncer.Settings != nil { + clusterResource.PgBouncer.Settings = &[]PgBouncerSettingsModel{} + for _, v := range *cluster.PgBouncer.Settings { + *clusterResource.PgBouncer.Settings = append(*clusterResource.PgBouncer.Settings, PgBouncerSettingsModel{ + Name: *v.Name, + Operation: *v.Operation, + Value: *v.Value, + }) + } + } + } + return nil } @@ -784,6 +851,24 @@ func generateGenericClusterModel(clusterResource ClusterResourceModel) models.Cl } } + if clusterResource.PgBouncer != nil { + cluster.PgBouncer = &models.PgBouncer{} + cluster.PgBouncer.IsEnabled = clusterResource.PgBouncer.IsEnabled + if clusterResource.PgBouncer.Settings != nil { + cluster.PgBouncer.Settings = &[]models.PgBouncerSettings{} + for _, v := range *clusterResource.PgBouncer.Settings { + v := v + *cluster.PgBouncer.Settings = append(*cluster.PgBouncer.Settings, + models.PgBouncerSettings{ + Name: &v.Name, + Operation: &v.Operation, + Value: &v.Value, + }, + ) + } + } + } + return cluster }