From e9ed3b2c3b0c69378ab2e98f04e55a9f9f48ff5b Mon Sep 17 00:00:00 2001 From: Keefer Bibby Date: Thu, 17 Oct 2024 13:04:51 -0700 Subject: [PATCH 1/6] Bump sdk version + fix hvs breaking changes --- go.mod | 2 +- go.sum | 4 ++-- internal/clients/vault_secrets_preview.go | 2 +- .../provider/vaultsecrets/rotating_secret_mongodb_atlas.go | 2 +- internal/provider/vaultsecrets/rotating_secret_twilio.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 32412af0e..9456172a8 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.7.0 - github.com/hashicorp/hcp-sdk-go v0.116.0 + github.com/hashicorp/hcp-sdk-go v0.117.0 github.com/hashicorp/terraform-plugin-docs v0.19.4 github.com/hashicorp/terraform-plugin-framework v1.5.0 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 diff --git a/go.sum b/go.sum index a9e3f83ca..d555c1ec7 100644 --- a/go.sum +++ b/go.sum @@ -122,8 +122,8 @@ github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC16 github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA= 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/hcp-sdk-go v0.116.0 h1:WhmEzOxoswQsX0s8Hk84RE1avu+rwV2e51R8uOb9ZhY= -github.com/hashicorp/hcp-sdk-go v0.116.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk= +github.com/hashicorp/hcp-sdk-go v0.117.0 h1:7lJpkinpWdsXtejC+X7MdaE/3zhFMweB9Ym3uJ7qFJw= +github.com/hashicorp/hcp-sdk-go v0.117.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk= 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.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= diff --git a/internal/clients/vault_secrets_preview.go b/internal/clients/vault_secrets_preview.go index 51e297577..acb54df59 100644 --- a/internal/clients/vault_secrets_preview.go +++ b/internal/clients/vault_secrets_preview.go @@ -96,7 +96,7 @@ func GetRotatingSecretState(ctx context.Context, client *Client, loc *sharedmode WithOrganizationID(loc.OrganizationID). WithProjectID(loc.ProjectID). WithAppName(appName). - WithSecretName(secretName) + WithName(secretName) resp, err := client.VaultSecretsPreview.GetRotatingSecretState(params, nil) if err != nil { diff --git a/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go b/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go index d72b99e46..05ecf7219 100644 --- a/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go +++ b/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go @@ -22,7 +22,7 @@ func (s *mongoDBAtlasRotatingSecret) read(ctx context.Context, client secret_ser WithOrganizationID(secret.OrganizationID.ValueString()). WithProjectID(secret.ProjectID.ValueString()). WithAppName(secret.AppName.ValueString()). - WithSecretName(secret.Name.ValueString()), nil) + WithName(secret.Name.ValueString()), nil) if err != nil && !clients.IsResponseCodeNotFound(err) { return nil, err } diff --git a/internal/provider/vaultsecrets/rotating_secret_twilio.go b/internal/provider/vaultsecrets/rotating_secret_twilio.go index 29eec8900..02664a798 100644 --- a/internal/provider/vaultsecrets/rotating_secret_twilio.go +++ b/internal/provider/vaultsecrets/rotating_secret_twilio.go @@ -21,7 +21,7 @@ func (s *twilioRotatingSecret) read(ctx context.Context, client secret_service.C WithOrganizationID(secret.OrganizationID.ValueString()). WithProjectID(secret.ProjectID.ValueString()). WithAppName(secret.AppName.ValueString()). - WithSecretName(secret.Name.ValueString()), nil) + WithName(secret.Name.ValueString()), nil) if err != nil && !clients.IsResponseCodeNotFound(err) { return nil, err } From 9a81b44d1f8b8e556d0113006fa19cb381c4846b Mon Sep 17 00:00:00 2001 From: Keefer Bibby Date: Thu, 17 Oct 2024 13:29:54 -0700 Subject: [PATCH 2/6] changelog --- .changelog/1122.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/1122.txt diff --git a/.changelog/1122.txt b/.changelog/1122.txt new file mode 100644 index 000000000..63a838948 --- /dev/null +++ b/.changelog/1122.txt @@ -0,0 +1,3 @@ +```release-note:improvement +Upgrade the HCP SDK and fix breaking change w/ Vault Secrets +``` From e351652a111456699d4cf2908cba845fa7bb7c16 Mon Sep 17 00:00:00 2001 From: Keefer Bibby Date: Thu, 17 Oct 2024 15:39:27 -0700 Subject: [PATCH 3/6] missed a couple secret_names --- .../vaultsecrets/data_source_vault_secrets_rotating_secret.go | 4 ++-- .../data_source_vault_secrets_rotating_secret_test.go | 2 +- .../provider/vaultsecrets/rotating_secret_mongodb_atlas.go | 2 +- internal/provider/vaultsecrets/rotating_secret_twilio.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go index 11ebfd98d..8e299360c 100644 --- a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go +++ b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go @@ -23,7 +23,7 @@ type DataSourceVaultSecretsRotatingSecretModel struct { AppName types.String `tfsdk:"app_name"` ProjectID types.String `tfsdk:"project_id"` OrgID types.String `tfsdk:"organization_id"` - SecretName types.String `tfsdk:"secret_name"` + Name types.String `tfsdk:"name"` SecretValues types.Map `tfsdk:"secret_values"` SecretVersion types.Int64 `tfsdk:"secret_version"` SecretProvider types.String `tfsdk:"secret_provider"` @@ -113,7 +113,7 @@ func (d *DataSourceVaultSecretsRotatingSecret) Read(ctx context.Context, req dat ProjectID: client.Config.ProjectID, } - openSecret, err := clients.OpenVaultSecretsAppSecret(ctx, client, loc, data.AppName.ValueString(), data.SecretName.ValueString()) + openSecret, err := clients.OpenVaultSecretsAppSecret(ctx, client, loc, data.AppName.ValueString(), data.Name.ValueString()) if err != nil { resp.Diagnostics.AddError(err.Error(), "Unable to open secret") return diff --git a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret_test.go b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret_test.go index 75e33ce88..21a3df3ad 100644 --- a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret_test.go +++ b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret_test.go @@ -66,7 +66,7 @@ func TestAcc_dataSourceVaultSecretsRotatingSecret(t *testing.T) { } reqBody := secretmodels.SecretServiceCreateMongoDBAtlasRotatingSecretBody{ - SecretName: testSecretName, + Name: testSecretName, IntegrationName: testIntegrationName, RotationPolicyName: "built-in:30-days-2-active", SecretDetails: &secretmodels.Secrets20231128MongoDBAtlasSecretDetails{ diff --git a/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go b/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go index 05ecf7219..e231ac22a 100644 --- a/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go +++ b/internal/provider/vaultsecrets/rotating_secret_mongodb_atlas.go @@ -49,7 +49,7 @@ func (s *mongoDBAtlasRotatingSecret) create(ctx context.Context, client secret_s MongodbGroupID: secret.MongoDBAtlasUser.ProjectID.ValueString(), MongodbRoles: secret.mongoDBRoles, }, - SecretName: secret.Name.ValueString(), + Name: secret.Name.ValueString(), }), nil) if err != nil { diff --git a/internal/provider/vaultsecrets/rotating_secret_twilio.go b/internal/provider/vaultsecrets/rotating_secret_twilio.go index 02664a798..38c8c4c6b 100644 --- a/internal/provider/vaultsecrets/rotating_secret_twilio.go +++ b/internal/provider/vaultsecrets/rotating_secret_twilio.go @@ -40,7 +40,7 @@ func (s *twilioRotatingSecret) create(ctx context.Context, client secret_service WithBody(&secretmodels.SecretServiceCreateTwilioRotatingSecretBody{ RotationPolicyName: secret.RotationPolicyName.ValueString(), IntegrationName: secret.IntegrationName.ValueString(), - SecretName: secret.Name.ValueString(), + Name: secret.Name.ValueString(), }), nil) if err != nil { From c5ed03c3433811e6c22d4d075738fcfc7418f8a6 Mon Sep 17 00:00:00 2001 From: Keefer Bibby Date: Mon, 21 Oct 2024 10:28:27 -0700 Subject: [PATCH 4/6] revert breaking change --- .../vaultsecrets/data_source_vault_secrets_rotating_secret.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go index 8e299360c..68478afb3 100644 --- a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go +++ b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go @@ -23,7 +23,7 @@ type DataSourceVaultSecretsRotatingSecretModel struct { AppName types.String `tfsdk:"app_name"` ProjectID types.String `tfsdk:"project_id"` OrgID types.String `tfsdk:"organization_id"` - Name types.String `tfsdk:"name"` + SecretName types.String `tfsdk:"secret_name"` SecretValues types.Map `tfsdk:"secret_values"` SecretVersion types.Int64 `tfsdk:"secret_version"` SecretProvider types.String `tfsdk:"secret_provider"` From ddbb7e82ab6ef1e697c6429b0a9539931a7bc319 Mon Sep 17 00:00:00 2001 From: Keefer Bibby Date: Mon, 21 Oct 2024 14:03:14 -0700 Subject: [PATCH 5/6] revert breaking change --- .../vaultsecrets/data_source_vault_secrets_rotating_secret.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go index 68478afb3..11ebfd98d 100644 --- a/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go +++ b/internal/provider/vaultsecrets/data_source_vault_secrets_rotating_secret.go @@ -113,7 +113,7 @@ func (d *DataSourceVaultSecretsRotatingSecret) Read(ctx context.Context, req dat ProjectID: client.Config.ProjectID, } - openSecret, err := clients.OpenVaultSecretsAppSecret(ctx, client, loc, data.AppName.ValueString(), data.Name.ValueString()) + openSecret, err := clients.OpenVaultSecretsAppSecret(ctx, client, loc, data.AppName.ValueString(), data.SecretName.ValueString()) if err != nil { resp.Diagnostics.AddError(err.Error(), "Unable to open secret") return From 4d2808b1ce3d3f124d1fbb7de20d2cdc965a0a05 Mon Sep 17 00:00:00 2001 From: Keefer Bibby Date: Tue, 22 Oct 2024 11:18:22 -0700 Subject: [PATCH 6/6] update changelog --- .changelog/1122.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/1122.txt b/.changelog/1122.txt index 63a838948..c43507049 100644 --- a/.changelog/1122.txt +++ b/.changelog/1122.txt @@ -1,3 +1,3 @@ ```release-note:improvement -Upgrade the HCP SDK and fix breaking change w/ Vault Secrets +Upgrade the HCP SDK for Vault Secrets ```