This is OK but gets a bit awkward when attempting to separate functions into TF modules. For example if I have a module that creates a deployment (call it elastic_deployment) to add a snapshot repository to this deployment you need access to a elasticstack provider - but modules can't define providers so this needs to happen in the next level up (call it the main module) - so a repository feature needs to go in a second module so that it can have a provider passed to it (especially if creating multiple deployments and using provider aliases) - however now, the elastic_deployment module needs knowledge of things created for the snapshot namely the s3 bucket access credentials as they need to be passed at creation. So I end up with three modules as the s3 bucket creation + access credentials needs to happen before the deployment is created.
Ideally this could be avoided by allowing the ec_deployment_elasticsearch_keystore to trigger a reload for reloadable values - in this case I could keep all the snapshot logic in the one module. I'm not really sure what the use case is for the ec_deployment_elasticsearch_keystore without this functionality since you can't use anything it creates until a deployment is restarted.
At the least it would be good to mention this limitation on the resource docs to avoid this refactor when you discover that the keystore actually requires a deployment restart
Overview
I can see previous issues with using the
ec_deployment_elasticsearch_keystore
resource that require restarting the deployment eg https://github.com/elastic/terraform-provider-ec/issues/780, https://github.com/elastic/terraform-provider-ec/issues/433 and that there was a solution provided to allow passing keystore values during deployment creation.This is OK but gets a bit awkward when attempting to separate functions into TF modules. For example if I have a module that creates a deployment (call it
elastic_deployment
) to add a snapshot repository to this deployment you need access to a elasticstack provider - but modules can't define providers so this needs to happen in the next level up (call it themain
module) - so a repository feature needs to go in a second module so that it can have a provider passed to it (especially if creating multiple deployments and using provider aliases) - however now, theelastic_deployment
module needs knowledge of things created for the snapshot namely the s3 bucket access credentials as they need to be passed at creation. So I end up with three modules as the s3 bucket creation + access credentials needs to happen before the deployment is created.Ideally this could be avoided by allowing the
ec_deployment_elasticsearch_keystore
to trigger a reload for reloadable values - in this case I could keep all the snapshot logic in the one module. I'm not really sure what the use case is for theec_deployment_elasticsearch_keystore
without this functionality since you can't use anything it creates until a deployment is restarted.At the least it would be good to mention this limitation on the resource docs to avoid this refactor when you discover that the keystore actually requires a deployment restart
Possible Implementation
Testing
Context
Your Environment