Git Product home page Git Product logo

terragrunt's Introduction

enhanced tool to manage terraform deployment with terragrunt

If enjoy, please consider buying me a coffee.

Auto-trigger docker build for terragrunt when new terraform version is related.

DockerHub Badge

Tools included in this container

  • terraform - terraform version is this docker image's tag
  • terragrunt - The latest terragrunt version when running the build.
  • boilerplate - The latest boilerplate version when running the build.
  • terraform-docs - The latest terraform-docs version when running the build.

Repo:

https://github.com/alpine-docker/terragrunt

Daily build logs:

https://app.circleci.com/pipelines/github/alpine-docker/terragrunt

Docker image tags:

https://hub.docker.com/r/alpine/terragrunt/tags/

Multiple platforms supported

  • linux/arm64
  • linux/amd64
  • linux/386

Why we need it

This is mostly used during Continuous Integration and Continuous Delivery (CI/CD), or as a component of an automated build and deployment process.

Usage:

# (1) must mount the local folder to /apps in container.
# (2) must mount the aws credentials and ssh config folder in container.
$ docker run -ti --rm -v $HOME/.aws:/root/.aws -v ${HOME}/.ssh:/root/.ssh -v `pwd`:/apps alpine/terragrunt:0.12.16 bash
#
# common terraform steps
$ terraform init
$ terraform fmt
$ terraform validate
$ terraform plan
$ terraform apply
#
# common terragrunt steps
# cd to terragrunt configuration directory, if required.
$ terragrunt hclfmt
$ terragrunt run-all plan
$ terragrunt run-all apply

The Processes to build this image

  • Enable CI cronjob on this repo to run build weekly on master branch
  • Check if there are new versions announced via Terraform Github REST API
  • Match the exist docker image tags via Hub.docker.io REST API
  • If not matched, build the image with latest terraform version as tag and push to hub.docker.com
  • Always install latest version of terragrunt

terragrunt's People

Contributors

amontalban avatar apeckham avatar ozbillwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

terragrunt's Issues

Automation is broken for terraform 0.12

Just an FYI that it seems the automation is broken. Terraform 0.12.31 exists, but the latest alpine/terragrunt for version 12 is still 0.12.30

I don't have time to investigate this now, I fixed something up locally. If I get some time I'll try to PR a fix at a later date.

Build trigger request

Hello there Terragrunt released a new version v0.32.6 I am dependent on that version and I am using this image. Also builds are failing for last 2 days

AWS EKS image is not getting built anymore

Hey, this project used to provide/build a separate image which includes dependencies necessary to deploy to AWS eks.

The latest published one is terragrunt 1.0.1-eks which was published several months ago.

I guess this didn't happen on purpose, but because of an oversight when migration to circle-ci happened.

  1. Do you accept merge requests to restore the behavior?
  2. Should the eks image be added to the main branch instead of maintaining it on a different branch?

If yes, I would propose doing the following:

  • using dockerfile builder pattern so (FROM <image> as <base>) and later FROM <base> as <eks>
  • adjust the build.sh to build --target <base> and then adding a second job that does --target <eks>
  • adjust .circleci/config.yml to build & publish both images

Thank you in advance

Cannot set variables into gitlab-ci

When I try set variables via gitlab-ci. I got ERROR bellow, please help

╷
│ Error: Value for undeclared variable
│ 
│ A variable named "function_name" was assigned on the command line, but the
│ root module does not declare a variable of that name. To use this value,
│ add a "variable" block to the configuration.
╵
╷
│ Error: Value for undeclared variable
│ 
│ A variable named "image_uri" was assigned on the command line, but the root
│ module does not declare a variable of that name. To use this value, add a
│ "variable" block to the configuration.
╵
time=2024-04-18T09:26:[30](https://gitlab-test.dev/test-ops/-/jobs/127566#L30)Z level=error
time=2024-04-18T09:26:30Z level=error 
ERROR: Job failed: exit code 1

.gitlab-ci.yaml

deploy:
  stage: deploy-test
  image: 
    name: alpine/terragrunt:1.8.1
  before_script:
    - terragrunt plan -var="function_name=${PROJECT_NAME}" -var="image_uri=123456789.dkr.ecr.${ECR_REGION}.amazonaws.com/${CI_PROJECT_NAME}:${PROJECT_NAME}-${CI_COMMIT_SHORT_SHA}"
  script:
    - terragrunt apply -var="function_name=${PROJECT_NAME}" -var="image_uri=123456789.dkr.ecr.${ECR_REGION}.amazonaws.com/${CI_PROJECT_NAME}:${PROJECT_NAME}-${CI_COMMIT_SHORT_SHA}" --auto-approve

terragrunt.hcl

include "root" {
  path = find_in_parent_folders()
}

terraform {
  source = "https://github.com/terraform-aws-modules/terraform-aws-lambda.git"
}

inputs = {
  function_name   = "var.function_name"
  description     = "My awesome lambda function 5555555"
  create_package  = false
  image_uri       = "var.image_uri"
  package_type    = "Image"
}

terragrunt.hcl in root folder

remote_state {
  backend = "s3"
  generate = {
    path      = "backend.tf"
    if_exists = "overwrite"
  }
  config = {
    bucket         = "test-bucket"
    key            = "${path_relative_to_include()}/terraform.tfstate"
    region         = "eu-north-1"
    encrypt        = true
  }
}

On my local machine terragrunt normaly work

Improve image versioning to track Terragrunt's version too

Terraform recently changed it's license and this has caused some concern amongst it's users. As this container packages the latest versions of both Terraform and Terragrunt, we've already switched to versions of Terraform with the new license.

I also think it'd be nice for this to be tagged with the Terragrunt version instead of the Terraform version as it's named after that package.

I'm proposing that there are five groups of versions for this package:

  1. <terragrunt_version> - Terragrunt with the newest officially compatible Terraform version. Today this would be 0.52.5 and contain Terragrunt v0.52.5 and Terraform v1.5.7.
  2. <terraform_version> - Terraform with the newest version of Terragrunt at that time, same as we're currently releasing. Today this would be 1.6.1 and contain Terragrunt v0.52.5 and Terraform v1.6.1
  3. <terragrunt_version>-tf<terraform-version> - specific versions of both, but only the "latest" versions would be built. Today this would be 0.52.5-tf1.6.1 and be identical to <terraform_version>
  4. <terragrunt_version>-tf1.5.7 - latest version of Terragrunt with Terraform v1.5.7 - this is for people who want to stay on a version of Terraform prior to the license change. Until a release version of OpenTofu is released, this would be identical to <terragrunt_version>.
  5. <terragrunt_version>-ot<opentofu-version> - latest version of Terragrunt with the latest version of OpenTofu. Today this would be 0.52.5-ot1.6.0-alpha3 and contain Terragrunt v0.52.5 and OpenTofu v1.6.0-alpha3. That said, as OpenTofu doesn't have a release version or official Docker container image yet, this will probably be skipped.

Terragrunt version compatibility table: https://terragrunt.gruntwork.io/docs/getting-started/supported-versions/ - note that they're not claiming compatibility with Terraform v1.6+.
OpenTofu: https://github.com/opentofu/opentofu
Terraform license change concerns: https://opentofu.org/manifesto

If this is something you're happy with, I'm happy to do the work to get this up and running.

Image tags should track Terragrunt versions

Currently, there are several new versions of Terragrunt released, but the TravisCI build is not updating anything, because there has not been a Terraform release in the same time frame.

I believe the version of the terragrunt image tag should track the terragrunt version. It also makes sense to include the Terraform version in the tag. I will submit a PR with a proposal.

Request build for docker image with Terraform version 0.11.15-oci

I couldn't find an image for Terraform version 0.11.15-oci on the Docker registry.
Can I requested to have an image with that tag built. I think the highest corresponding version of Terragrunt supported is 0.18.7.

Let me know if this is a reasonable ask. Thanks!

Provide arm64 build

As alpine, terragrunt and terraform are available for arm64 it would be useful, if this docker image would also be available for arm64

0.13.7 is missing

Just an FYI that the 0.13.7 version of the image is missing. Terraform 0.13.7 was released in april.

Request build for Terraform `v0.13.0-beta1` (and future 0.13 betas)

Hi, firstly thank you for maintaining this repo and releasing the Terragrunt docker images. They are incredibly useful for us for deploying our Terraform code using Gitlab CI.

Terraform v0.13.0-beta1 was released today and we would like to adopt this beta straight away. To that end, it would be a massive help for us (and possibly other users) to have a build of this image using that Terraform version. I don't think the latest tag for this repo should point to beta releases, but it would be awesome if we could use the specific version tag to get it.

I'm not sure if the build script is set up to do this currently, happy to make a CR to adapt it if that's acceptable.

Thanks again!

Looser version tracking tags

It would be helpful to be able to follow versions more losely, like tracking major or minor versions.
This could be achieved by tagging additionally, and since OCI is Content-Addressed, it won't consume any more storage.

Build requests stopped 9 days ago

Just wanted to let you folks know it looks like your build requests stopped. Came looking for 1.0.2 image, thanks for all the work you've done!

Request to build terragrunt image with terraform 0.13.6

I see that 0.13.5 image was the last image from 0.13 series.
Terraform release 0.13.6 was out on Jan 6th.
Our remote state is not set to that version so I cannot use 0.13.5. image, but also am not ready to move to 0.14.x.

Could you provide an official build for 0.13.6?

Terragrunt image tagged with 0.11.15 has an incompatible terragrunt version (too fresh)

It seems that the new terragrunt build system packs an incompatible terragrunt version (0.29.0) with the new terraform 0.11.15. You will get HCL-related errors even if there are only old .tfvars/.tf files in our repo. The new tf 0.11.15 version is needed as the provider signing keys at Hashicorp were changed.

$ docker run -ti --rm alpine/terragrunt:0.11.15 bash
bash-5.1# terragrunt --version
terragrunt version v0.29.0

$ docker run -ti --rm alpine/terragrunt:0.11.14 bash
bash-4.4# terragrunt --version
terragrunt version v0.18.6

The error we encounter with the new terragrunt

terragrunt get --terragrunt-source-update
Error reading file at path terragrunt.hcl: open [..]/terragrunt.hcl: no such file or directory
Unable to determine underlying exit code, so Terragrunt will exit with error code 1

The old terragrunt works for our purposes and we bypass this issue atm. using this Dockerfile

FROM alpine/terragrunt:0.11.14
RUN apk add --update --no-cache curl unzip

RUN curl -o terraform.zip https://releases.hashicorp.com/terraform/0.11.15/terraform_0.11.15_linux_amd64.zip
RUN unzip terraform.zip
RUN cp terraform /usr/local/bin/terraform

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.