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

docs: document how-to use terragrunt with terraform-provider-minikube #136

Closed
caerulescens opened this issue Feb 4, 2024 · 5 comments · Fixed by #165
Closed

docs: document how-to use terragrunt with terraform-provider-minikube #136

caerulescens opened this issue Feb 4, 2024 · 5 comments · Fixed by #165
Assignees

Comments

@caerulescens
Copy link
Contributor

caerulescens commented Feb 4, 2024

terragrunt is an open source tool created by GruntWorks.io, and it's used as a wrapper to terraform where it provides features that terraform cannot provide. The goal of the documentation is to show another way to use the minikube, kubernetes, and helm providers together because it doesn't replace terraform usage; it extends terraform usage.

This is something that I would like to document for the open source community as I'm not really sure if anyone knows this is possible because I figured it out on my own using terraform-provider-minikube.

There are a lot of advantages:

  • terragrunt has dedicated support for opentofu, which fits with @scott-the-programmer and GruntWorks.io's goals to bridge the industry licensing issue that's causing the migration (see [Feature] Refactor dev setup to accomodate for opentofu #120)
  • The terraform project is downloaded using git, which encourages caching and reproducible init / plan / apply sequences through GitOps
  • You can use a common configuration for all terraform-provider-minikube usage, which keeps your HCL 100% dry while providing 100% control over common settings between different drivers (docker, kvm2, qemu2, ...). This has a lot to do with how the project's structure is designed, which I would like to cover.
  • You can template the values within providers block, meaning that kubernetes_version from terraform-provider-minikube can be templated:
locals {
  kubernetes_version = "v1.28.3"
}

generate "provider" {
  path      = "provider.tf"
  if_exists = "overwrite"
  contents  = <<EOF
provider "minikube" {
  kubernetes_version = "${local.kubernetes_version}"
}
EOF
}
  • You can template the values with the remote_state block in a similar way:
remote_state {
  backend = "local"
  generate = {
    path      = "backend.tf"
    if_exists = "overwrite"
  }
  config = {
    path = "${get_parent_terragrunt_dir()}/${path_relative_to_include()}/terraform.tfstate"
  }
}
@caerulescens
Copy link
Contributor Author

@scott-the-programmer Would you assign this one to me? How do you think this information should manifest? Should it be docs only? Should it be a repository? I already have a cookiecutter template that I'm about to tag and release in the coming weeks which will provide all necessary structure and design for using terraform-provider-minikube with terragrunt.

I think it would be best to document the minimum necessary design to use terragrunt, terraform-provider-minikube, terraform-provider-helm, and terraform-provider-kubernetes together while linking to the cookiecutter template on GitHub. The cookiecutter template I've created allows for initializing a "production-ready" structure and more advanced practices that would make the example too complex for terraform-provider-minikube newcomers.

@caerulescens
Copy link
Contributor Author

caerulescens commented Feb 4, 2024

Maybe making two sections in the docs:

  • terraform usage
  • terragrunt usage

And both show kubernetes and helm usage.

@scott-the-programmer
Copy link
Owner

Yep, sounds good to me!

@caerulescens
Copy link
Contributor Author

I haven't forgotten about this; I'm going to get to this sometime this week.

@caerulescens caerulescens changed the title docs: document how-to use terragrunt with minikube, kubernetes, and helm providers docs: document how-to use terragrunt with terraform-provider-minikube Jul 14, 2024
@caerulescens
Copy link
Contributor Author

Worked on this tonight; I'll add final edits tomorrow. The example works as expected, so only edits to docs should be needed to complete this. I changed the scope of the ticket to be simpler because I think it'll be more helpful.

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 a pull request may close this issue.

2 participants