From 603e57b7bd190aa3df0c1297a885798503036921 Mon Sep 17 00:00:00 2001 From: Daniel Huckins Date: Thu, 29 Aug 2024 10:43:34 -0400 Subject: [PATCH] update hcp-sdk-go and breaking change w/ hvs api (#1080) * update hcp-sdk-go and breaking change w/ hvs api * add changelog * go mod tidy --- .changelog/1080.txt | 3 +++ go.mod | 2 +- go.sum | 4 ++-- internal/clients/vault_secrets_preview.go | 13 +++++++++---- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 .changelog/1080.txt diff --git a/.changelog/1080.txt b/.changelog/1080.txt new file mode 100644 index 000000000..04e20b24c --- /dev/null +++ b/.changelog/1080.txt @@ -0,0 +1,3 @@ +```release-note:improvement +update hcp-sdk-go +``` diff --git a/go.mod b/go.mod index ce32395c6..e638c286d 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.105.0 + github.com/hashicorp/hcp-sdk-go v0.110.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 f127c6a6e..fdea8e90f 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.105.0 h1:KKqOBi13+wMEvMEG65brBJIXzvZcxjehVzk6vipaaSE= -github.com/hashicorp/hcp-sdk-go v0.105.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk= +github.com/hashicorp/hcp-sdk-go v0.110.0 h1:eaDO6XoEb0H+g00Ka3C+ZbRibhwWyA2YNmv48xFCL2w= +github.com/hashicorp/hcp-sdk-go v0.110.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 10e4487f9..c31bb544b 100644 --- a/internal/clients/vault_secrets_preview.go +++ b/internal/clients/vault_secrets_preview.go @@ -102,9 +102,14 @@ func GetRotatingSecretState(ctx context.Context, client *Client, loc *sharedmode // CreateMongoDBAtlasRotationIntegration NOTE: currently just needed for tests func CreateMongoDBAtlasRotationIntegration(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, integrationName, mongodbAtlasPublicKey, mongodbAtlasPrivateKey string) (*secretmodels.Secrets20231128MongoDBAtlasIntegration, error) { body := secretmodels.SecretServiceCreateMongoDBAtlasIntegrationBody{ - IntegrationName: integrationName, - MongodbAPIPublicKey: mongodbAtlasPublicKey, - MongodbAPIPrivateKey: mongodbAtlasPrivateKey, + Name: integrationName, + Capabilities: []*secretmodels.Secrets20231128Capability{ + secretmodels.Secrets20231128CapabilityROTATION.Pointer(), + }, + StaticCredentialDetails: &secretmodels.Secrets20231128MongoDBAtlasStaticCredentialsRequest{ + APIPublicKey: mongodbAtlasPublicKey, + APIPrivateKey: mongodbAtlasPrivateKey, + }, } params := secret_service.NewCreateMongoDBAtlasIntegrationParamsWithContext(ctx). WithOrganizationID(loc.OrganizationID). @@ -124,7 +129,7 @@ func DeleteMongoDBAtlasRotationIntegration(ctx context.Context, client *Client, params := secret_service.NewDeleteMongoDBAtlasIntegrationParamsWithContext(ctx). WithOrganizationID(loc.OrganizationID). WithProjectID(loc.ProjectID). - WithIntegrationName(integrationName) + WithName(integrationName) _, err := client.VaultSecretsPreview.DeleteMongoDBAtlasIntegration(params, nil) if err != nil {