Skip to content

Terraform init hooks tutorial #1376

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

Merged
merged 15 commits into from
Jul 23, 2024
Merged

Terraform init hooks tutorial #1376

merged 15 commits into from
Jul 23, 2024

Conversation

tinyg210
Copy link
Contributor

@tinyg210 tinyg210 commented Jul 12, 2024

This tutorial covers:

  • using Terraform config files directly as init hooks
  • using TF files as init hooks with docker compose
  • integrating TF init hooks with Testcontainers to ensure consistency across dev, test & prod environments

This PR also contains the documentation section (/references/init-hooks/) for init hooks describing how to use TF config files.

Copy link

github-actions bot commented Jul 12, 2024

🎊 PR Preview has been successfully built and deployed to https://localstack-docs-preview-pr-1376.surge.sh 🎊

@tinyg210 tinyg210 requested a review from thrau July 12, 2024 21:07
Copy link
Contributor

@remotesynth remotesynth left a comment

Choose a reason for hiding this comment

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

I made some small changes to the text but otherwise this looks really great. I like that you added the testcontainers to the tutorial as this provides a more real world scenario of how this feature would be used.

@tinyg210 tinyg210 requested a review from HarshCasper July 15, 2024 23:42
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

Great tutorial @tinyg210, really comprehensive and detailed. Perhaps a bit long, but it contains all the technical nitty-gritty details that almost serves as a documentation/reference guide in itself. 👍

My review are mostly nits, nothing blocking!

I added several suggestions to improve the text a bit, feel free to apply the ones you like and agree with.

Some "drive-by" feedback/tips on writing: The text is a bit repetitive at times, and contains a lot of boilerplate statements/prose. I think overall the next tutorial we write could be improved by writing a bit more tersely/concisely. Also I noticed, sometimes we're using the same words to mean different things, and sometimes we use different words to mean the same things. Resources, configuration, setup, integrate... Something to look out for and be mindful of. And look out for monologophobia :-)

But really just nit picks on the text. Overall, really great work on the technical details, and thanks so much for grabbing the extension and immediately churning out this amazing sample project! agree with @remotesynth on the real world use case 🚀

### Using multiple TF files

When organizing your Terraform files into folders, recursion can be a highly effective strategy. This approach allows you to manage multiple Terraform projects within a single structure efficiently.
This feature supports recursive script execution, which can be useful for various scenarios.
Copy link
Member

Choose a reason for hiding this comment

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

maybe delete this line

Suggested change
This feature supports recursive script execution, which can be useful for various scenarios.


## Conclusion

Leveraging Terraform init hooks allows us to precisely replicate our production infrastructure within our testing environments, ensuring that our Infrastructure as Code is
Copy link
Member

Choose a reason for hiding this comment

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

i think precisely replicating our production infrastructure is maybe not focusing on the real benefits of the terraform init hooks. perhaps focusing on the aspects of automation (configurations being automatically applied), the setup being self-contained (both the extension being installed), and reproducability (we can easily reproduce the same setup every time).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! I needed a fresh pair of eyes for this because I was getting sick of reading my own text over and over. You were right, I dislike repeating words in the same phrase, even in the same paragraph, but somehow I managed to repeat myself with the same idea, different words. I made the suggested changes and also replaced the ambiguous wording. I also tried to be more mindful of the one sentence per line (I broke it up because of the small screen).

@tinyg210 tinyg210 removed the request for review from HarshCasper July 18, 2024 16:29
@HarshCasper HarshCasper merged commit 1053d92 into main Jul 23, 2024
5 checks passed
@HarshCasper HarshCasper deleted the terraform_init_hooks_tutorial branch July 23, 2024 11:59
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.

4 participants