-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
158 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
terraform 1.5.7 | ||
terragrunt 0.51.3 |
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,32 @@ | ||
FROM registry.access.redhat.com/ubi9:9.2-755@sha256:351ed8b24d440c348486efd99587046e88bb966890a9207a5851d3a34a4dd346 | ||
|
||
ARG HOME=/root | ||
ARG USERNAME=user | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
ARG USER_HOME=/home/$USERNAME | ||
|
||
COPY requirements.txt .tool-versions $HOME | ||
ARG ROOT_HOME=/root | ||
|
||
COPY requirements.txt $ROOT_HOME | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID $USERNAME && \ | ||
chown -R $USER_UID:$USER_GID /home/$USERNAME && \ | ||
dnf install -y git python3-pip make unzip && \ | ||
dnf clean all -y && \ | ||
pip3 install -r $ROOT_HOME/requirements.txt && \ | ||
update-ca-trust | ||
|
||
USER $USERNAME | ||
|
||
# renovate: datasource=github-releases depName=asdf-vm/asdf | ||
ENV ASDF_VERSION=v0.13.1 | ||
|
||
RUN dnf install -y git python3-pip make unzip && \ | ||
dnf clean all -y && \ | ||
git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch "${ASDF_VERSION}" --depth 1 && \ | ||
. $HOME/.asdf/asdf.sh && \ | ||
echo . "$HOME/.asdf/asdf.sh" > $HOME/.bash_profile && \ | ||
COPY .tool-versions $USER_HOME | ||
|
||
RUN git clone https://github.com/asdf-vm/asdf.git $USER_HOME/.asdf --branch "${ASDF_VERSION}" --depth 1 && \ | ||
. $USER_HOME/.asdf/asdf.sh && \ | ||
echo . "$USER_HOME/.asdf/asdf.sh" > $USER_HOME/.bash_profile && \ | ||
asdf plugin-add terraform https://github.com/asdf-community/asdf-hashicorp.git && \ | ||
asdf install && \ | ||
pip3 install -r $HOME/requirements.txt | ||
asdf plugin-add terragrunt https://github.com/ohmer/asdf-terragrunt.git && \ | ||
asdf install |
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
.vscode/ | ||
*.backup | ||
backend.hcl | ||
.terragrunt-cache/ |
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,2 @@ | ||
all | ||
exclude_rule 'MD007' |
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 @@ | ||
style '.mdl_style.rb' |
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,24 +1,21 @@ | ||
.PHONY: all clean test init plan apply import | ||
.PHONY: all clean test | ||
|
||
include .env | ||
export | ||
ENV := dev | ||
TERRAGRUNT_CMD = cd live/${ENV} && terragrunt run-all --terragrunt-non-interactive | ||
|
||
init: | ||
terraform init -backend-config=backend.hcl | ||
.PHONY: tf/init | ||
tf/init: | ||
${TERRAGRUNT_CMD} init -backend-config=backend.hcl | ||
|
||
plan: | ||
dotenv run terraform plan | ||
.PHONY: tf/plan | ||
tf/plan: | ||
${TERRAGRUNT_CMD} plan | ||
|
||
apply: | ||
dotenv run terraform apply | ||
.PHONY: tf/apply | ||
tf/apply: | ||
${TERRAGRUNT_CMD} apply | ||
|
||
.PHONY: tf/import | ||
import: | ||
dotenv run terraform import gitlab_group.top_level_group $(TF_VAR_top_level_group_full_path) | ||
dotenv run terraform import gitlab_user.bot_user $(TF_VAR_gitlab_bot_user) | ||
|
||
all: clean init plan | ||
|
||
clean: | ||
rm -f terraform.tfstate | ||
|
||
test: plan |
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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
locals { | ||
environment = "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
terraform { | ||
source = "../../../modules//members" | ||
extra_arguments "var-file" { | ||
commands = ["apply", "plan"] | ||
arguments = ["-var-file=dev.tfvars"] | ||
} | ||
} | ||
|
||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
locals { | ||
environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) | ||
} | ||
|
||
inputs = merge( | ||
local.environment_vars.locals | ||
) |
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,3 @@ | ||
locals { | ||
environment = "prod" | ||
} |
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,19 @@ | ||
terraform { | ||
source = "../../../modules//members" | ||
extra_arguments "var-file" { | ||
commands = ["apply", "plan"] | ||
arguments = ["-var-file=prod.tfvars"] | ||
} | ||
} | ||
|
||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
locals { | ||
environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) | ||
} | ||
|
||
inputs = merge( | ||
local.environment_vars.locals | ||
) |
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,37 @@ | ||
remote_state { | ||
backend = "s3" | ||
generate = { | ||
path = "backend.tf" | ||
if_exists = "overwrite" | ||
} | ||
config = { | ||
bucket = "pe-tf-backend" | ||
key = "${path_relative_to_include()}/terraform.tfstate" | ||
region = "eu-west-2" | ||
profile = "default" | ||
encrypt = true | ||
dynamodb_table = "pe-tf-backend" | ||
s3_bucket_tags = { | ||
"Project" = "Platform Engineering" | ||
"User" = "lmilbaum" | ||
} | ||
dynamodb_table_tags = { | ||
"Project" = "Platform Engineering" | ||
"User" = "lmilbaum" | ||
} | ||
} | ||
} | ||
|
||
generate "provider" { | ||
path = "provider.tf" | ||
if_exists = "overwrite" | ||
contents = <<EOF | ||
provider "aws" { | ||
region = var.aws_region | ||
profile = var.aws_profile | ||
default_tags { | ||
tags = { "Project" = "Platform Engineering", "User" = "lmilbaum" } | ||
} | ||
} | ||
EOF | ||
} |
File renamed without changes.
File renamed without changes.
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