-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vault secrets | rotated secrets data source #854
Conversation
…t.go Co-authored-by: Anton Averchenkov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM!
resp.Diagnostics.Append(diag...) | ||
|
||
// TODO: what is ID supposed to be? | ||
// data.ID = ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ID actually used for unique identification of data sources or by anything TF-provider-specific? If not, maybe one option is to just remove it altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im honestly not sure, would like some feedback from @hashicorp/cloud-foundations
otherwise maybe something like
project/<project id>/app/<app name>/secret/<secret name>
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If our goal here is a unique resource identifier, this will almost work. The only scenario where I see it failing is if you delete the secret and re-create it with the same name. However, this is much better than the AppName that we are using elsewhere.
My preferred solution would still be to remove it if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll want to change these once the schema version is bumped to latest
WithProjectID(loc.ProjectID). | ||
WithBody(body) | ||
|
||
resp, err := client.VaultSecretsPreview.CreateMongoDBAtlasRotationIntegration(params, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resp, err := client.VaultSecretsPreview.CreateMongoDBAtlasRotationIntegration(params, nil) | |
resp, err := client.VaultSecretsPreview.CreateMongoDBAtlasIntegration(params, nil) |
WithProjectID(loc.ProjectID). | ||
WithIntegrationName(integrationName) | ||
|
||
_, err := client.VaultSecretsPreview.DeleteMongoDBAtlasRotationIntegration(params, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_, err := client.VaultSecretsPreview.DeleteMongoDBAtlasRotationIntegration(params, nil) | |
_, err := client.VaultSecretsPreview.DeleteMongoDBAtlasIntegration(params, nil) |
MongodbAPIPublicKey: mongodbAtlasPublicKey, | ||
MongodbAPIPrivateKey: mongodbAtlasPrivateKey, | ||
} | ||
params := secret_service.NewCreateMongoDBAtlasRotationIntegrationParamsWithContext(ctx). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params := secret_service.NewCreateMongoDBAtlasRotationIntegrationParamsWithContext(ctx). | |
params := secret_service.NewCreateMongoDBAtlasIntegrationParamsWithContext(ctx). |
|
||
// DeleteMongoDBAtlasRotationIntegration NOTE: currently just needed for tests | ||
func DeleteMongoDBAtlasRotationIntegration(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, integrationName string) error { | ||
params := secret_service.NewDeleteMongoDBAtlasRotationIntegrationParamsWithContext(ctx). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params := secret_service.NewDeleteMongoDBAtlasRotationIntegrationParamsWithContext(ctx). | |
params := secret_service.NewDeleteMongoDBAtlasIntegrationParamsWithContext(ctx). |
…to dh/vault-secrets/rotated-secrets-data-source
…to dh/vault-secrets/rotated-secrets-data-source
|
||
// block until the secret is done | ||
// TODO: is the time amount excessive? | ||
timer := time.AfterFunc(20*time.Minute, func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: timeout
might be a better name
t.Log("secret successfully rotated") | ||
return | ||
default: | ||
time.Sleep(time.Minute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time.Sleep(time.Minute) | |
time.Sleep(10*time.Second) |
🛠️ Description
🏗️ Acceptance tests
Output from acceptance testing:
$ make testacc TESTARGS='-run=TestAccXXX' ...