-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add dry_run and fix s3 backend merging behaviour #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for tackling this @lakkeger ! Great to see that we're addressing an often requested feature from our users 🚀
I have a few minor nitpick comments, and one more fundamental question related to comparing the file hashes in the tests..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for the quick turnaround and addressing all the comments @lakkeger ! 🚀
except Exception as e: | ||
print(f'Unable to parse "{override_file}" as HCL file: {e}') | ||
|
||
new_options_check = "endpoints" in result and all(map(lambda x: x in result.get("endpoints"), new_options)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! That's great - seems much cleaner imo (and more forward-compatible) to parse the file and explicitly check for the contents we're expecting. 👌 (as compared to the file hashing)
Motivation
Dry run
DRY_RUN
env variableS3 backend endpoints behaviour
Old behaviour
endpoints
block defined, uses that even if its incompleteendpoint
,sts_endpoint
...etc) are present in the original file and Terraform >v1.5 it ignores these optionsNew behaviour
Terraform version >1.5:
endpoints
is present:endpoints
set, uses1.ii.a.
behaviourendpoints
are set, see behaviour at endpointsTerraform version <=1.5:
From the created data structure according to the Terraform version generates the right s3 backend config:
endpoints
blockChanges
DRY_RUN
env variableendpoints
behaviour