-
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
HCP Vault Secrets Generic Integration #1151
Conversation
|
||
func (r *resourceVaultSecretsIntegration) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { | ||
attributes := map[string]schema.Attribute{ | ||
"provider_type": schema.StringAttribute{ |
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.
provider_type was used instead of provider since it is a reserved Terraform word.
Validators: []validator.String{ | ||
stringvalidator.OneOf(ProviderStrings()...), | ||
}, | ||
}, |
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.
All the fields below are just an aggregation of the provider-specific schemas.
GcpFederatedWorkloadIdentity: integration.gcpFederatedWorkloadIdentity, | ||
MongoDbAtlasStaticCredentials: integration.mongoDBAtlasStaticCredentials, | ||
TwilioStaticCredentials: integration.twilioStaticCredentials, | ||
}, |
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.
The API enforces that only exactly one of these is non-nil.
@@ -49,6 +50,7 @@ var rotatingSecretsImpl = map[Provider]rotatingSecret{ | |||
ProviderAWS: &awsRotatingSecret{}, | |||
ProviderGCP: &gcpRotatingSecret{}, | |||
ProviderMongoDBAtlas: &mongoDBAtlasRotatingSecret{}, | |||
"mongodb_atlas": &mongoDBAtlasRotatingSecret{}, // The provider name changed to mongodb-atlas to fit with the HVS API, this is for backwards compatibility |
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.
👍🏻
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.
LGTM 🚢
🛠️ Description
We initially implemented the HVS integrations as separate resources. However, the ecosystem initiative aims to significantly increase our catalog, and a distinct resource per provider won't scale well.
This also sets the stage to more easily support custom-built or community-contributed integrations or credential types in the future.
The implementation leverages the polymorphic API endpoints and follows the more generic resource design used for hcp_vault_secrets_dynamic_secret and hcp_vault_secrets_rotating_secret.
The existing provider-specific integration resources are marked as deprecated so we can eventually phase them out.
🏗️ Acceptance tests
Output from acceptance testing:
I don't have a screenshot for each but all the ACC tests were reworked to use the generic integration resource. All providers are covered and green.