-
Notifications
You must be signed in to change notification settings - Fork 548
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 22912/sync config #2125
Vault 22912/sync config #2125
Conversation
030ea71
to
3422d66
Compare
* format * imports * use proper version check * using defaults
e790dde
to
404c524
Compare
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.
Thanks for working on this! Things are looking great, had a couple initial thoughts. Whenever you get the time, could we also add the documentation for this resource to close out the loop on development? Thanks again!
fieldDisabled: { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, |
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.
Let's avoid setting the default here and let the Vault default value handle that case by marking this as Computed
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 request on the Vault side is implemented as a PATCH. If we remove the default value from the TF schema, omitting a field in the resource definition keep it as is instead of reverting to Vault's default. This may be ok if we document it accordingly but most often I've seen that removing an optional field in a TF resource should update it to some default value.
For example, if the current config is:
"data": {
"disabled": false,
"queue_capacity": 1234
},
This TF resource definition resets it to 1,000,000:
resource "vault_secrets_sync_config" "cfg" {
disabled = false
}
If we remove the default value here, the same TF resource definition has no effect instead because Vault is called an empty queue_capacity
field.
Does that make sense? Are we fine with the behavior of not updating to a default value for a missing field?
+ actually save content to the statefile
128080b
to
864c3e7
Compare
…p' into VAULT-22912/sync-config
Done! |
@vinay-gopalan I added the doc so I'll go ahead and merge the PR so it is ready to ship with the rest of the TFVP support. Let me know if the explanation for the default value make sense. If you'd like to discuss a different approach or there are other adjustments to do on the config resource please ping me, I'll fix them in a follow-up PR! |
4da4fbd
into
VAULT-18672/aws-secrets-sync-loop
Description
This PR adds a resource to manage the global config of the enterprise Secrets Sync feature.
This API is only available on the root namespace so using a provider defined on a different namespace will error during the creation. Let me know if this is something that could/should be covered by automated tests.
Since the config is global, in theory it should not be possible to define this resource twice for the same Vault cluster but I'm not sure this is something that can be prevented as code. If a user defines the resource twice, the last config to be applied will be effective.
Checklist