-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from gruntwork-io/SME-228/LIB-70/opentofu-mise…
…-tg-action
- Loading branch information
Showing
11 changed files
with
208 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/gruntwork-io/pre-commit | ||
rev: v0.1.23 | ||
hooks: | ||
- id: terraform-fmt | ||
- id: goimports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
# Dockerfile used in execution of Github Action | ||
FROM gruntwork/terragrunt:0.0.2 | ||
MAINTAINER Gruntwork <[email protected]> | ||
FROM gruntwork/terragrunt:0.1.0 | ||
LABEL maintainer "Gruntwork <[email protected]>" | ||
|
||
ENV MISE_CONFIG_DIR=~/.config/mise | ||
ENV MISE_STATE_DIR=~/.local/state/mise | ||
ENV MISE_DATA_DIR=~/.local/share/mise | ||
ENV MISE_CACHE_DIR=~/.cache/mise | ||
ENV ASDF_HASHICORP_TERRAFORM_VERSION_FILE=.terraform-version | ||
|
||
ENV PATH="~/.local/share/mise/shims:~/mise:${PATH}" | ||
|
||
COPY ["./src/main.sh", "/action/main.sh"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# Container to run Terragrunt and Terraform | ||
# Contains inside TFenv and TGSwitch to allow users to install custom Terraform and Terragrunt versions | ||
# Contains inside mise to allow users to install custom Terraform and Terragrunt versions | ||
FROM ubuntu:22.04 | ||
MAINTAINER Gruntwork <[email protected]> | ||
LABEL maintainer "Gruntwork <[email protected]>" | ||
|
||
ARG TF_ENV_VERSION=v3.0.0 | ||
ARG TGSWITCH_VERSION=0.6.0 | ||
ARG MISE_VERSION_INSTALL=v2024.4.0 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y \ | ||
|
@@ -17,28 +16,29 @@ RUN apt-get update && apt-get install -y \ | |
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create runner user | ||
RUN addgroup --system --gid 127 docker | ||
RUN useradd --system -u 1001 -g 127 -ms /bin/bash runner | ||
RUN usermod -aG sudo runner && echo 'runner ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
RUN addgroup --system --gid 127 docker \ | ||
&& useradd --system -u 1001 -g 127 -ms /bin/bash runner \ | ||
&& usermod -aG sudo runner && echo 'runner ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
USER runner | ||
WORKDIR /home/runner | ||
|
||
RUN mkdir -p /home/runner/.ssh | ||
COPY ./known_hosts /home/runner/.ssh/known_hosts | ||
|
||
# clone tfenv | ||
RUN git clone --depth=1 --branch ${TF_ENV_VERSION} https://github.com/tfutils/tfenv.git ~/.tfenv | ||
RUN echo 'export PATH="${HOME}/.tfenv/bin:${PATH}"' >> ~/.bash_profile | ||
# install mise | ||
RUN mkdir -p "${HOME}/mise" \ | ||
&& wget -q "https://github.com/jdx/mise/releases/download/${MISE_VERSION_INSTALL}/mise-${MISE_VERSION_INSTALL}-linux-x64" -O "/${HOME}/mise/mise" \ | ||
&& chmod u+x "${HOME}/mise/mise" | ||
|
||
# install tgswitch | ||
RUN mkdir -p "${HOME}/tgswitch" | ||
RUN wget -q https://github.com/warrensbox/tgswitch/releases/download/${TGSWITCH_VERSION}/tgswitch_${TGSWITCH_VERSION}_linux_amd64.tar.gz -O /tmp/tgswitch_${TGSWITCH_VERSION}_linux_amd64.tar.gz | ||
RUN tar -xzf /tmp/tgswitch_${TGSWITCH_VERSION}_linux_amd64.tar.gz -C ${HOME}/tgswitch | ||
RUN chmod u+x ${HOME}/tgswitch/tgswitch | ||
RUN rm -rf /tmp/tgswitch_${TGSWITCH_VERSION}_linux_amd64.tar.gz | ||
ENV MISE_CONFIG_DIR=~/.config/mise | ||
ENV MISE_STATE_DIR=~/.local/state/mise | ||
ENV MISE_DATA_DIR=~/.local/share/mise | ||
ENV MISE_CACHE_DIR=~/.cache/mise | ||
ENV ASDF_HASHICORP_TERRAFORM_VERSION_FILE=.terraform-version | ||
|
||
# Running action as runner user | ||
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user | ||
ENV PATH="/home/runner/.tfenv/bin:/home/runner/tgswitch:/home/runner/bin:${PATH}" | ||
ENV PATH="~/.local/share/mise/shims:~/mise:${PATH}" | ||
|
||
ENV TF_INPUT=false | ||
ENV TF_IN_AUTOMATION=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
# Docker image to run terragrunt | ||
|
||
Docker image with TGEnv and TGSwitch installed inside, which can be used to install and run Terragrunt. | ||
Docker image with [`mise`](https://mise.jdx.dev/) installed inside, which can be used to install and run Terragrunt. | ||
|
||
Example usage: | ||
``` | ||
tfenv install "1.4.6" | ||
tfenv use "1.4.6" | ||
TG_VERSION="0.46.3" tgswitch | ||
mise use terraform@1.4.6 | ||
mise use [email protected] | ||
mise use terragrunt@0.46.3 | ||
terragrunt ... | ||
``` | ||
|
||
## References | ||
|
||
* https://github.com/tfutils/tfenv | ||
* https://github.com/warrensbox/tgswitch | ||
* https://mise.jdx.dev/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.