-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
d767fd2
commit 410c59d
Showing
34 changed files
with
444 additions
and
10 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
.terraform.lock.hcl | ||
|
||
# ========================================= | ||
/.env/ | ||
/venv/ | ||
/volume/ | ||
|
||
**/.terraform/ | ||
|
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,3 +1,2 @@ | ||
providers.tf | ||
versions.tf | ||
dependencies.png |
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,16 +1,38 @@ | ||
# Dependencies | ||
|
||
- backend-app depends on mysql, redis, and vpc | ||
- frontend-app depends on backend-app and vpc | ||
- mysql depends on vpc | ||
- redis depends on vpc | ||
- vpc has no dependencies | ||
|
||
```bash | ||
terragrunt graph-dependencies | dot -Tpng > dependencies.png | ||
``` | ||
|
||
![img.png](dependencies.png) | ||
|
||
------------------------------------ | ||
|
||
## Run it | ||
|
||
```bash | ||
export TERRAGRUNT_PARALLELISM=4 | ||
|
||
terragrunt run-all plan | ||
terragrunt run-all apply | ||
terragrunt run-all destroy | ||
``` | ||
|
||
- The module 1 has no dependency | ||
- The module 2 depends on module 1 | ||
- The module 3 must be build after module 1 but do not need its outputs | ||
- The module 4 depends on module 1, 2 and 3 | ||
<br/> | ||
|
||
#### Includes backend and the ones it depends on | ||
|
||
```bash | ||
terragrunt run-all \ | ||
--terragrunt-include-external-dependencies \ | ||
--terragrunt-working-dir ./backend \ | ||
apply | ||
``` | ||
|
||
<br/> | ||
|
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,30 @@ | ||
|
||
|
||
variable "vpc_name" { | ||
type = string | ||
default = "my-vpc-1" | ||
} | ||
variable "redis_arn" { | ||
type = string | ||
} | ||
variable "mysql_arn" { | ||
type = string | ||
} | ||
|
||
|
||
resource aws_s3_bucket "main" { | ||
bucket = join("-", [var.vpc_name, "backend"]) | ||
} | ||
|
||
output "arn" { | ||
value = aws_s3_bucket.main.arn | ||
} | ||
output "name" { | ||
value = aws_s3_bucket.main.bucket | ||
} | ||
output "redis_arn" { | ||
value = var.redis_arn | ||
} | ||
output "mysql_arn" { | ||
value = var.mysql_arn | ||
} |
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,32 @@ | ||
|
||
# ignore for now | ||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
|
||
dependency "vpc" { | ||
config_path = "../vpc" | ||
mock_outputs = { | ||
name = "" | ||
} | ||
} | ||
dependency "redis" { | ||
config_path = "../redis" | ||
mock_outputs = { | ||
arn = "" | ||
} | ||
} | ||
dependency "mysql" { | ||
config_path = "../mysql" | ||
mock_outputs = { | ||
arn = "" | ||
} | ||
} | ||
|
||
inputs = { | ||
vpc_name = dependency.vpc.outputs.name | ||
redis_arn = dependency.redis.outputs.arn | ||
mysql_arn = dependency.mysql.outputs.arn | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
|
||
|
||
|
||
|
||
resource aws_s3_bucket "main" { | ||
bucket = "frontend" | ||
} | ||
|
||
output "arn" { | ||
value = aws_s3_bucket.main.arn | ||
} | ||
output "name" { | ||
value = aws_s3_bucket.main.bucket | ||
} |
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,14 @@ | ||
|
||
# ignore for now | ||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
dependencies { | ||
paths = ["../vpc", "../backend"] | ||
} | ||
|
||
|
||
|
||
|
||
|
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,18 @@ | ||
|
||
|
||
|
||
variable "vpc_name" { | ||
type = string | ||
default = "my-vpc-1" | ||
} | ||
|
||
resource aws_s3_bucket "main" { | ||
bucket = join("-", [var.vpc_name, "mysql"]) | ||
} | ||
|
||
output "arn" { | ||
value = aws_s3_bucket.main.arn | ||
} | ||
output "name" { | ||
value = aws_s3_bucket.main.bucket | ||
} |
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,21 @@ | ||
|
||
# ignore for now | ||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
|
||
dependency "vpc" { | ||
config_path = "../vpc" | ||
mock_outputs = { | ||
arn = "" | ||
name = "" | ||
} | ||
} | ||
|
||
inputs = { | ||
vpc_name = dependency.vpc.outputs.name | ||
} | ||
|
||
|
||
|
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,17 @@ | ||
|
||
|
||
variable "vpc_name" { | ||
type = string | ||
default = "my-vpc-1" | ||
} | ||
|
||
resource aws_s3_bucket "main" { | ||
bucket = join("-", [var.vpc_name, "redis"]) | ||
} | ||
|
||
output "arn" { | ||
value = aws_s3_bucket.main.arn | ||
} | ||
output "name" { | ||
value = aws_s3_bucket.main.bucket | ||
} |
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,21 @@ | ||
|
||
# ignore for now | ||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
|
||
dependency "vpc" { | ||
config_path = "../vpc" | ||
mock_outputs = { | ||
arn = "" | ||
name = "" | ||
} | ||
} | ||
|
||
inputs = { | ||
vpc_name = dependency.vpc.outputs.name | ||
} | ||
|
||
|
||
|
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,17 @@ | ||
|
||
|
||
variable "name" { | ||
type = string | ||
default = "my-vpc-1" | ||
} | ||
|
||
resource aws_s3_bucket "main" { | ||
bucket = var.name | ||
} | ||
|
||
output "arn" { | ||
value = aws_s3_bucket.main.arn | ||
} | ||
output "name" { | ||
value = aws_s3_bucket.main.bucket | ||
} |
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,13 @@ | ||
|
||
# ignore for now | ||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
|
||
inputs = { | ||
name = "vpc1" | ||
} | ||
|
||
|
||
|
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,6 +1,6 @@ | ||
|
||
|
||
include "env" { | ||
include "root" { | ||
path = find_in_parent_folders("terragrunt.hcl") | ||
} | ||
|
||
|
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,40 @@ | ||
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa | ||
provider "aws" { | ||
access_key = "test" | ||
secret_key = "test" | ||
region = "us-east-1" | ||
|
||
# only required for non virtual hosted-style endpoint use case. | ||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs#s3_use_path_style | ||
s3_use_path_style = true | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
skip_requesting_account_id = true | ||
|
||
|
||
endpoints { | ||
apigateway = "http://localhost:4566" | ||
apigatewayv2 = "http://localhost:4566" | ||
cloudformation = "http://localhost:4566" | ||
cloudwatch = "http://localhost:4566" | ||
dynamodb = "http://localhost:4566" | ||
ec2 = "http://localhost:4566" | ||
es = "http://localhost:4566" | ||
elasticache = "http://localhost:4566" | ||
firehose = "http://localhost:4566" | ||
iam = "http://localhost:4566" | ||
kinesis = "http://localhost:4566" | ||
lambda = "http://localhost:4566" | ||
rds = "http://localhost:4566" | ||
redshift = "http://localhost:4566" | ||
route53 = "http://localhost:4566" | ||
s3 = "http://s3.localhost.localstack.cloud:4566" | ||
secretsmanager = "http://localhost:4566" | ||
ses = "http://localhost:4566" | ||
sns = "http://localhost:4566" | ||
sqs = "http://localhost:4566" | ||
ssm = "http://localhost:4566" | ||
stepfunctions = "http://localhost:4566" | ||
sts = "http://localhost:4566" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa | ||
terraform { | ||
required_version = ">= 0.12.0" | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.52.0" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa | ||
provider "aws" { | ||
access_key = "test" | ||
secret_key = "test" | ||
region = "us-east-1" | ||
|
||
# only required for non virtual hosted-style endpoint use case. | ||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs#s3_use_path_style | ||
s3_use_path_style = true | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
skip_requesting_account_id = true | ||
|
||
|
||
endpoints { | ||
apigateway = "http://localhost:4566" | ||
apigatewayv2 = "http://localhost:4566" | ||
cloudformation = "http://localhost:4566" | ||
cloudwatch = "http://localhost:4566" | ||
dynamodb = "http://localhost:4566" | ||
ec2 = "http://localhost:4566" | ||
es = "http://localhost:4566" | ||
elasticache = "http://localhost:4566" | ||
firehose = "http://localhost:4566" | ||
iam = "http://localhost:4566" | ||
kinesis = "http://localhost:4566" | ||
lambda = "http://localhost:4566" | ||
rds = "http://localhost:4566" | ||
redshift = "http://localhost:4566" | ||
route53 = "http://localhost:4566" | ||
s3 = "http://s3.localhost.localstack.cloud:4566" | ||
secretsmanager = "http://localhost:4566" | ||
ses = "http://localhost:4566" | ||
sns = "http://localhost:4566" | ||
sqs = "http://localhost:4566" | ||
ssm = "http://localhost:4566" | ||
stepfunctions = "http://localhost:4566" | ||
sts = "http://localhost:4566" | ||
} | ||
} |
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.