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

Terragrunt support #29

Merged

Conversation

davidtam
Copy link
Collaborator

@davidtam davidtam commented Jun 1, 2021

I merged master into the branch and fixed a few things - now I am able to run all the tests and passed

@google-cla
Copy link

google-cla bot commented Jun 1, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Jun 1, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Jun 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@ludoo
Copy link
Collaborator

ludoo commented Jun 2, 2021

Let me know when you think this is ready for merging in the Terragrunt branch, then we'll pick it up from there. And could you check the CLA notice above plz? :)

@google-cla
Copy link

google-cla bot commented Jun 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@davidtam
Copy link
Collaborator Author

davidtam commented Jun 2, 2021

Let me know when you think this is ready for merging in the Terragrunt branch, then we'll pick it up from there. And could you check the CLA notice above plz? :)

Hi for CLA I have already signed (We found a Contributor License Agreement for you (the sender of this pull request)), what else do I need to do there?

I could spend a bit more time refactor today(but IMHO the PR is already quite / too big for review!). but what are your thoughts for the current state?
I could (and thinking about) continue with the following:

  • There are a few patterns(boolean/k v pair/k dict pair) for the kwargs parsing and could simplify based on that
  • I think a lot of the calls (plan / apply / etc) in the tg branch that are currently splitted between terraform and terragrunt could be merged
    • I think the special case for output could be shared
    • the additional tg params would do no harm when running terraform
    • this makes it less verbose / more DRY (which I prefer), but perhaps less clear cut (maybe, e.g. a bit more difficult to debug if merged?)

@ludoo what do you think?

@google-cla
Copy link

google-cla bot commented Jun 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Jun 4, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@davidtam
Copy link
Collaborator Author

davidtam commented Jun 4, 2021

ok I am done with it - the test runs locally for me (but I permission to see the test run from GCP, pls let me know what is failing). @ludoo do you mind taking a look at the rest also?

@ludoo
Copy link
Collaborator

ludoo commented Jun 5, 2021

Failing test:

run_all_plan_output = [<tftest.TerraformPlanOutput object at 0x7f088ef00b70>, <tftest.TerraformPlanOutput object at 0x7f088ef00c50>, <tftest.TerraformPlanOutput object at 0x7f088ef00d30>]

    def test_run_all_plan(run_all_plan_output):
      for plan in run_all_plan_output:
>       assert plan.outputs['triggers'] == [{'name': 'one', 'template': 'sample template one'},
                                            {'name': 'two', 'template': 'sample template two'}]
E       AssertionError: assert [{'name': 'fo...emplate foo'}] == [{'name': 'on...emplate two'}]
E         At index 0 diff: {'name': 'foo', 'template': 'sample template foo'} != {'name': 'one', 'template': 'sample template one'}
E         Right contains one more item: {'name': 'two', 'template': 'sample template two'}
E         Full diff:
E         - [{'name': 'foo', 'template': 'sample template foo'}]
E         ?            - ^                                - ^  ^
E         + [{'name': 'one', 'template': 'sample template one'},
E         ?             ^^                                 ^^  ^...
E         
E         ...Full output truncated (2 lines hidden), use '-vv' to show

test/test_tg_all.py:69: AssertionError

@ludoo
Copy link
Collaborator

ludoo commented Jun 5, 2021

I'm happy to merge, then give you access to the branch so we can iron out the remaining details. WDYT?

@davidtam
Copy link
Collaborator Author

davidtam commented Jun 5, 2021

I'm happy to merge, then give you access to the branch so we can iron out the remaining details. WDYT?

ah ok yes pls that would be great

@ludoo ludoo merged commit b56b45f into GoogleCloudPlatform:terragrunt-support Jun 5, 2021
@ludoo
Copy link
Collaborator

ludoo commented Jun 5, 2021

Done!

Can you add the relevant Terragrunt bits to the README, and make sure all tests pass? I'll go over the code ASAP (hopefully between tonight and tomorrow), so we can try and merge this in the next few days. And thanks for all the hard work! :)

ludoo added a commit that referenced this pull request Jun 7, 2021
* Add Terragrunt integration and general parser (#24)

* - add kw parser
- add tg command methods

* - add plan_all parse output progress
- replace terra* command func cli params with **kw

* add tgbinary to ci

* - add tg shared doc string decorator
- separate some of the public methods tg_xxx() | tf_xxx()
- fix parse_args() styling

* - Rollback parse_args()
- Add tg global args to parse_args()
- Add tg global args decorator
- Add all param to tg_xxx methods

* - mv tg flags before tf flags for cli args
- add common tg args to tg methods

* - fix tg source module warning
- add output() fixture to tg test

* bump version

* Terragrunt support (#29)

* Don't fail when resource_changes key not present in output (#27)

* Resolves #26 tftest failed when terraform plan is empty

* add missing copyright boilerplate

Co-authored-by: Ludovico Magnocavallo <[email protected]>

* Update CHANGELOG.md

* Update CHANGELOG.md

* v1.5.6 for pypi

* made minimal changes to fix tests (now all passed locally for me)

* added a bit of code to parse run-all output and test to assert output

* added terragrunt run in single dir test case + simplified run-all

* added test cases for terragrunt parse args

* refactored terragrunt cmd line parameters parsing

* refactored as a separated class(TerragruntTest) but reused most of TerraformTest

Co-authored-by: Mike Brown II <[email protected]>
Co-authored-by: Ludovico Magnocavallo <[email protected]>
Co-authored-by: Ludovico Magnocavallo <[email protected]>

* speed up tests(session scope to reuse fixtures) + work around for strange tf run-all plan behaviour

* added back change log

* adding newline at end of file

* Adding terragrunt section to readme

* added some doc strings

* remove binary param from _clean_up to fix tests

* Update README.md

* Update README.md

* Update CHANGELOG.md

* Update tftest.py

Co-authored-by: Marshall Mamiya <[email protected]>
Co-authored-by: Ludovico Magnocavallo <[email protected]>
Co-authored-by: Mike Brown II <[email protected]>
Co-authored-by: Ludovico Magnocavallo <[email protected]>
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.

3 participants