Skip to content

Commit

Permalink
Add terragrunt
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswilding committed Jul 7, 2021
1 parent b6738a5 commit 2767119
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ crash.log

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
**/backend.tf
override.tf
override.tf.json
*_override.tf
Expand All @@ -26,4 +27,4 @@ override.tf.json
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
*tfplan*
2 changes: 1 addition & 1 deletion backend/backend.tf → backend/default.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "aws_s3_bucket" "terraform" {
}

versioning {
enabled = true
enabled = true
}
}

Expand Down
8 changes: 0 additions & 8 deletions backend/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
terraform {
backend "s3" {
bucket = "terraform-nu2dp3915g"
key = "backend/state.tf"
region = "eu-west-1"

dynamodb_table = "terraform"
}

required_providers {
aws = {
source = "hashicorp/aws"
Expand Down
3 changes: 3 additions & 0 deletions backend/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include {
path = find_in_parent_folders()
}
2 changes: 1 addition & 1 deletion budget/budget.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "aws_sns_topic_subscription" "budget" {
resource "aws_budgets_budget" "budget" {
name = "budget"
budget_type = "COST"
limit_amount = "25"
limit_amount = "25.0"
limit_unit = "USD"
time_unit = "MONTHLY"
time_period_start = "2021-07-01_00:00"
Expand Down
11 changes: 5 additions & 6 deletions budget/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
terraform {
backend "s3" {
bucket = "terraform-nu2dp3915g"
key = "budget/state.tf"
region = "eu-west-1"

dynamodb_table = "terraform"
required_providers {
aws = {
source = "hashicorp/aws"
version = "> 3.0"
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions budget/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include {
path = find_in_parent_folders()
}
8 changes: 0 additions & 8 deletions iam/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
terraform {
backend "s3" {
bucket = "terraform-nu2dp3915g"
key = "iam/state.tf"
region = "eu-west-1"

dynamodb_table = "terraform"
}

required_providers {
aws = {
source = "hashicorp/aws"
Expand Down
3 changes: 3 additions & 0 deletions iam/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include {
path = find_in_parent_folders()
}
16 changes: 16 additions & 0 deletions terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
remote_state {
backend = "s3"

config = {
bucket = "terraform-nu2dp3915g"
dynamodb_table = "terraform"
encrypt = true
key = "${path_relative_to_include()}/state.tf"
region = "eu-west-1"
}

generate = {
path = "override.tf"
if_exists = "overwrite_terragrunt"
}
}

0 comments on commit 2767119

Please sign in to comment.