Skip to content

Commit 28b2ba0

Browse files
authored
feat: Add repo config file generator (#1)
* feat: Add repo config file generator * feat: Add support for terragrunt atlantis config hook * feat: Add yaml output and terragrunt workflows * chore: reformat loop blocks and update example readme file
1 parent 312fe3d commit 28b2ba0

File tree

20 files changed

+411
-665
lines changed

20 files changed

+411
-665
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ override.tf.json
2929
# Include override files you do wish to add to version control using negated pattern
3030
#
3131
# !example_override.tf
32+
33+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
34+
# example: *tfplan*
35+
*tfplan*

README.md

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

config/workflows.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
workflows:
2+
terraform-basic:
3+
plan:
4+
steps:
5+
- run: terraform init
6+
- run: terraform plan -no-color -input=false -out $PLANFILE
7+
apply:
8+
steps:
9+
- run: terraform apply -no-color -input=false -compact-warnings -auto-approve $PLANFILE
10+
11+
terragrunt-basic:
12+
plan:
13+
steps:
14+
- run: terragrunt fmt -no-color -check=true -diff=true -write=false
15+
- run: terragrunt hclfmt --terragrunt-check
16+
- run: terragrunt plan -no-color -out $PLANFILE
17+
apply:
18+
steps:
19+
- run: terragrunt apply -no-color -input=false -compact-warnings -auto-approve $PLANFILE
20+
21+
terragrunt-basic-with-asdf:
22+
plan:
23+
steps:
24+
- run: asdf install
25+
- run: terragrunt fmt -no-color -check=true -diff=true -write=false
26+
- run: terragrunt hclfmt --terragrunt-check
27+
- run: terragrunt plan -no-color -out $PLANFILE
28+
apply:
29+
steps:
30+
- run: terragrunt apply -no-color -input=false -compact-warnings -auto-approve $PLANFILE

context.tf

Lines changed: 0 additions & 279 deletions
This file was deleted.

examples/complete/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
repo_config.yaml

examples/complete/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
init:
2+
terraform init
3+
4+
plan:
5+
terraform plan -out tfplan
6+
7+
apply:
8+
terraform apply tfplan
9+
10+
destroy:
11+
terraform destroy

examples/complete/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Complete Example
2+
3+
```terraform
4+
module "repo_config" {
5+
source = "../../"
6+
7+
repos = [
8+
{
9+
id = "github.com/getindata/foo"
10+
workflow = "terraform-basic"
11+
},
12+
{
13+
id = "github.com/getindata/bar"
14+
workflow = "terraform-basic-with-fmt"
15+
allowed_overrides = ["delete_source_branch_on_merge"]
16+
},
17+
{
18+
id = "github.com/getindata/baz"
19+
allowed_overrides = ["workflow", "delete_source_branch_on_merge"]
20+
allow_custom_workflows = true
21+
allow_all_server_side_workflows = true
22+
23+
terragrunt_atlantis_config = {
24+
enabled = true
25+
autoplan = true
26+
}
27+
}
28+
]
29+
30+
repos_common_config = {
31+
apply_requirements = ["approved", "mergeable"]
32+
branch = "main"
33+
}
34+
35+
workflows = {
36+
terraform-basic-with-fmt = {
37+
plan = {
38+
steps = [
39+
{
40+
run = "terraform fmt -no-color -check=true -diff=true -write=false"
41+
},
42+
{
43+
run = "terraform plan -no-color -input=false -out $PLANFILE"
44+
}
45+
]
46+
}
47+
}
48+
}
49+
50+
repo_config_file_generation_enabled = true
51+
}
52+
```
53+
54+
## Usage
55+
Run the commands from below:
56+
```
57+
terraform init
58+
terraform plan -out tf.plan
59+
terraform apply tf.plan
60+
```

0 commit comments

Comments
 (0)