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

feat: Add ability to disable lifecycle prevent_destroy #43

Merged
merged 2 commits into from
Jan 24, 2022

Conversation

grahamhar
Copy link
Contributor

@grahamhar grahamhar commented Jan 23, 2022

This is a proposal to fix the issue described in #42

I have used features introduced in Python 3.5 and added a check in case people are using older versions of Python. If you think this needs to work on any version of Python 3 I'm happy to change the approach.

I have also only tested on MacOS, I assume in CI the tests ran under Linux. I'll try to get one of my colleagues who works on Windows to test this.

When the terraform under test or any modules in use have resources
with a prevent_destroy = true in the lifecycle block any attempts to use
destroy to clean up created resources will fail leaving resources in an
unmanged state.
Copy link
Collaborator

@ludoo ludoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! One minor doubt on exception handling when manipulating files, and I'm also wondering if it would make sense to use pathlib everywhere for consistency, now that you introduced it. It does not need to happen in this PR, of course, I would just like your opinion.

tftest.py Show resolved Hide resolved
Copy link
Collaborator

@ludoo ludoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this!

@ludoo ludoo merged commit c5244bc into GoogleCloudPlatform:master Jan 24, 2022
@grahamhar
Copy link
Contributor Author

Any idea when a version for this will be released?

@ludoo
Copy link
Collaborator

ludoo commented Jan 24, 2022

Actually had the tab open to remind me to do it, let me try and do it now.

@ludoo
Copy link
Collaborator

ludoo commented Jan 24, 2022

Done! https://pypi.org/project/tftest/1.6.4/

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

Successfully merging this pull request may close these issues.

2 participants