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

Terraform test: ability to expect overall failures of plan or apply command #35628

Open
throwaway58383958484 opened this issue Aug 22, 2024 · 1 comment
Labels
enhancement new new issue not yet triaged terraform test

Comments

@throwaway58383958484
Copy link

Terraform Version

1.9.4

Use Cases

I'm trying to test an AWS IAM role's trust policy. Under certain conditions (how the session is tagged), I expect to be able to assume the role when I configure the AWS provider's assume_role block. Under other conditions, I expect the role assumption to fail and cause the plan to fail. I am happily using terraform test to test the successful cases but, from what I understand, it's not useful for testing the failure cases.

I think it would be generally useful to be able to assert that terraform plan or terraform apply failed, and optionally specify some pattern we expect the error text to match.

Attempted Solutions

I tried using terraform test's expect_failures option, but it only appears to support custom conditions that we define on variables/resources/data sources. I don't see a way to do what I want using that mechanism.

Proposal

No response

References

No response

@throwaway58383958484 throwaway58383958484 added enhancement new new issue not yet triaged labels Aug 22, 2024
@crw
Copy link
Collaborator

crw commented Aug 22, 2024

Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged terraform test
Projects
None yet
Development

No branches or pull requests

3 participants