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

TEARDOWN_OFF does not seem to work with scopes other than function #42

Open
adam-turner-j opened this issue May 25, 2021 · 2 comments
Open
Labels
bug Something isn't working

Comments

@adam-turner-j
Copy link

The following snippet produces an apply and destroy despite the teardown option. Other scopes such as module produce the same result.

@terraform('network', scope='session', teardown=terraform.TEARDOWN_OFF)
def test_network(network):
    assert network['aws_vpc.main.cidr_block'] == '10.0.0.0/16'

When removing the scope argument and letting it default to function, the terraform is applied but not destroyed, as expected. Is there anything I am doing incorrectly?

@kapilt
Copy link
Contributor

kapilt commented Jul 2, 2021

hmm, thanks for the bug report.

@kapilt kapilt added the bug Something isn't working label Sep 9, 2021
@baolsen
Copy link
Contributor

baolsen commented Oct 14, 2022

+1

I have a use case for retaining the output of a local file resource to help with automated documentation.
The output from my test is added to the README.md to illustrate features to the user.

A workaround for my use case is to copy the file within a test case. Terraform will still destroy the file it created, but the copied one remains in-tact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants