Skip to content
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

Implementing terraform test #150

Open
tijnster opened this issue Nov 6, 2023 · 2 comments
Open

Implementing terraform test #150

tijnster opened this issue Nov 6, 2023 · 2 comments

Comments

@tijnster
Copy link

tijnster commented Nov 6, 2023

Hi!

I would like to test my terraform with terraform test, and I would like to execute that command from a function. There is no test function available yet in the current version. Would you be open to this? I think terraform test has officially left the beta stage as of terraform version 1.6. If you're open to this change, I can make a PR for it :).

@tobyclemson
Copy link
Member

Hi @tijnster,

Yes, we're very open to a PR for this.

As I understand it, you are looking to define your tests using terraform's new built-in testing framework but executing those tests from within Ruby, in which case, adding support for the test command is definitely the way to go. However, for an alternative approach, we've also built rspec-terraform which works in a similar way to terraforms testing framework but allows all tests to be written in Ruby vis rspec. Examples of how to use rspec-terraform are available in any of the terraform modules hosted here on the infrablocks organisation if you are interested.

Regardless, I'm very happy to accept a PR and get it merged in and released for you.
Thanks,
Toby

@tijnster
Copy link
Author

tijnster commented Nov 7, 2023

Hi @tobyclemson Yes, that's exactly what I'm trying to achieve. We are running the code from within a docker container, and programatically retrieving secrets from another microservice to talk with azure. Then we are setting the ARM ENV's to communicate with azure. In that perspective I don't think rspec-terraform will work (at least not for end 2 end, or actually deploying and verying infra), as there are no credentials available to communicate with azure. Or could I possible use a before hook for this? Rspec would be a good option though as it would be easier to include it in builds.

Nevertheless, I got some spare time this weekend. I've tried to look for a "way of working" for contributing, but did not find anything. Is there something like that available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants