-
Notifications
You must be signed in to change notification settings - Fork 71
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
Implement lxd_instance_file data resource #319
Implement lxd_instance_file data resource #319
Conversation
This resource represents a file that is created by the instance (possibly by a setup script) and provides a simple method for synchronization and communication between resources.
A data resource is the ideal terraform object that represents an externally created file.
a1072b3
to
a1241b2
Compare
87fb268
to
c3bd114
Compare
@jtopjian @adamcstephens this is ready for review |
3f91873
to
b0332fc
Compare
Do you have another use case besides the example given? It seems to me that using |
Yes. I'm using this for passing a ca certificate generated in one container (A squid package cache) to another container that uses it as a proxy. I'm sure there are more use cases for reading files from a container/VM though. |
Are you aware that resource output data gets put into the terraform state? The fact that the content is returned concerns me. |
Yes, but this is the case for other similar data resources: https://registry.terraform.io/providers/hashicorp/local/latest/docs/data-sources/file |
Thanks for that link. I'm ok with this resource given that example. We'll need some acceptance tests for this resource to ensure it works as desired. I'm thinking we need at least the cases where the file is retrieved and when the timeout occurs. I assume there is no case of missing file, since the retries will happen until the timeout. You can see some examples in the other resources, and here are a couple links: https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests |
Signed-off-by: Thiago Padilha <[email protected]>
4dc21cd
to
115600c
Compare
@adamcstephens I've tried writing an acceptance test based on the existing one for instance file resource and this one It doesn't look the tests are running correctly in my machine though (test always succeed). |
Are you sure you're running the acceptance tests? You can run them with |
I'm closing this since I've found shell script provider which has everything I need to automate LXD with terraform. If anyone else is interested, feel free to pick up where I stopped. |
This data source provides a simple method for reading data from files in the instance (not created by the current terraform config).
It can also be used as a method to synchronize instance creation and transfer data between them, as shown in the following example: