Skip to content

Commit a03d40e

Browse files
authored
Merge pull request #2 from StatusCakeDev/separate-feature-variables-into-objects
refactor: separate feature variables into objects
2 parents b167b1c + 0a841db commit a03d40e

File tree

23 files changed

+474
-326
lines changed

23 files changed

+474
-326
lines changed

.editorconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
root = true
66

7-
87
[*]
98
end_of_line = lf
109
charset = utf-8
@@ -13,9 +12,6 @@ insert_final_newline = true
1312
indent_style = space
1413
indent_size = 2
1514

16-
[*.{tf,tfvars}]
17-
indent_size = 2
18-
1915
[*.{diff,md}]
2016
trim_trailing_whitespace = false
2117

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,31 @@ assignees: ''
1010
A clear and concise description of what the bug is.
1111

1212
**To Reproduce**
13-
Steps to reproduce the behavior:
13+
Steps to reproduce the behaviour:
14+
1415
1. Go to '...'
1516
2. Click on '....'
1617
3. Scroll down to '....'
1718
4. See error
1819

19-
**Expected behavior**
20+
**Expected behaviour**
2021
A clear and concise description of what you expected to happen.
2122

2223
**Screenshots**
2324
If applicable, add screenshots to help explain your problem.
2425

2526
**Desktop (please complete the following information):**
26-
- OS: [e.g. iOS]
27-
- Browser [e.g. chrome, safari]
28-
- Version [e.g. 22]
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
2931

3032
**Smartphone (please complete the following information):**
31-
- Device: [e.g. iPhone6]
32-
- OS: [e.g. iOS8.1]
33-
- Browser [e.g. stock browser, safari]
34-
- Version [e.g. 22]
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
3538

3639
**Additional context**
3740
Add any other context about the problem here.

.github/workflows/policy.yaml

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,26 @@ jobs:
4242
node-version: 19.x
4343
- name: Install base config
4444
run: npm install @commitlint/config-conventional
45-
- name: Validate all commits
45+
- name: Validate commit messages
4646
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to HEAD --verbose
47+
markdown-style:
48+
name: Check markdown style
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v3
52+
with:
53+
fetch-depth: 0
54+
- uses: actions/setup-node@v3
55+
with:
56+
node-version: 19.x
57+
- name: Validate markdown
58+
run: npx markdownlint-cli2 **/*.md
4759
terraform:
48-
name: Check Terraform configuration formatting
60+
name: Check Terraform configuration style
4961
runs-on: ubuntu-latest
62+
permissions:
63+
contents: read
64+
pull-requests: write
5065
env:
5166
TF_IN_AUTOMATION: 1
5267
TF_INPUT: 0
@@ -55,7 +70,71 @@ jobs:
5570
- uses: hashicorp/setup-terraform@v2
5671
with:
5772
terraform_version: 1.3.6
58-
- run: terraform fmt -check -recursive
73+
- name: Check Terraform configuration
74+
id: fmt
75+
run: terraform fmt -check -recursive -diff
76+
- name: Initialise Terraform configuration
77+
id: init
78+
run: terraform init -backend=false
79+
- name: Validate Terraform configuration
80+
id: validate
81+
run: terraform validate -no-color
82+
- uses: actions/github-script@v6
83+
if: github.event_name == 'pull_request'
84+
with:
85+
github-token: ${{ secrets.GITHUB_TOKEN }}
86+
script: |
87+
// Retrieve existing bot comments for the PR.
88+
const { data: comments } = await github.rest.issues.listComments({
89+
owner: context.repo.owner,
90+
repo: context.repo.repo,
91+
issue_number: context.issue.number,
92+
});
93+
94+
const botComment = comments.find(comment => {
95+
return comment.user.type === 'Bot' && comment.body.includes('Terraform Format and Style')
96+
});
97+
98+
const formatSummary = `${{ steps.fmt.outputs.stdout }}`.trim() || 'No difference';
99+
100+
// Prepare format of the comment.
101+
const output = `| Step | Result |
102+
|------|--------|
103+
| Terraform Format and Style | \`${{ steps.fmt.outcome }}\` |
104+
| Terraform Initialization | \`${{ steps.init.outcome }}\` |
105+
| Terraform Validation | \`${{ steps.validate.outcome }}\` |
106+
<details>
107+
<summary><strong>Formatting Output</strong></summary>
108+
109+
\`\`\`diff
110+
${formatSummary}
111+
\`\`\`
112+
</details>
113+
114+
<details>
115+
<summary><strong>Validation Output</strong></summary>
116+
117+
\`\`\`
118+
${{ steps.validate.outputs.stdout }}
119+
\`\`\`
120+
</details>`;
121+
122+
// If we have a comment, update it, otherwise create a new one.
123+
if (botComment) {
124+
github.rest.issues.updateComment({
125+
owner: context.repo.owner,
126+
repo: context.repo.repo,
127+
comment_id: botComment.id,
128+
body: output,
129+
});
130+
} else {
131+
github.rest.issues.createComment({
132+
issue_number: context.issue.number,
133+
owner: context.repo.owner,
134+
repo: context.repo.repo,
135+
body: output,
136+
});
137+
}
59138
tfsec:
60139
name: Scan Terraform code for security vulnerabilities
61140
needs: terraform
@@ -68,8 +147,8 @@ jobs:
68147
- uses: aquasecurity/[email protected]
69148
with:
70149
github_token: ${{ github.token }}
71-
yamllint:
72-
name: Lint YAML documents
150+
yaml-style:
151+
name: Check YAML style
73152
runs-on: ubuntu-latest
74153
steps:
75154
- uses: actions/checkout@v3
@@ -78,5 +157,5 @@ jobs:
78157
python-version: "3.10"
79158
- name: Install yamllint
80159
run: pip install --user yamllint
81-
- name: Lint
160+
- name: Validate YAML
82161
run: yamllint .

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Local .terraform directories
22
**/.terraform/*
33

4+
# Terraform lock file
5+
.terraform.lock.hcl
6+
47
# .tfstate files
58
*.tfstate
69
*.tfstate.*

.markdownlint.jsonc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"default": true,
3+
"line-length": {
4+
"tables": false
5+
}
6+
}

CODE_OF_CONDUCT.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
In the interest of fostering an open and welcoming environment, we as
66
contributors and maintainers pledge to making participation in our project and
77
our community a harassment-free experience for everyone, regardless of age, body
8-
size, disability, ethnicity, gender identity and expression, level of experience,
9-
nationality, personal appearance, race, religion, or sexual identity and
10-
orientation.
8+
size, disability, ethnicity, gender identity and expression, level of
9+
experience, nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
1111

1212
## Our Standards
1313

1414
Examples of behaviour that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behaviour by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
- Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities
@@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable
3737
behaviour and are expected to take appropriate and fair corrective action in
3838
response to any instances of unacceptable behaviour.
3939

40-
Project maintainers have the right and responsibility to remove, edit, or
41-
reject comments, commits, code, wiki edits, issues, and other contributions
42-
that are not aligned to this Code of Conduct, or to ban temporarily or
43-
permanently any contributor for other behaviours that they deem inappropriate,
44-
threatening, offensive, or harmful.
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviours that they deem inappropriate, threatening,
44+
offensive, or harmful.
4545

4646
## Scope
4747

@@ -55,20 +55,21 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behaviour may be
58-
reported by contacting the project team at [email protected]. All
58+
reported by contacting the [project team](mailto:[email protected]). All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
61-
obligated to maintain confidentiality with regard to the reporter of an incident.
62-
Further details of specific enforcement policies may be posted separately.
61+
obligated to maintain confidentiality with regard to the reporter of an
62+
incident. Further details of specific enforcement policies may be posted
63+
separately.
6364

6465
Project maintainers who do not follow or enforce the Code of Conduct in good
6566
faith may face temporary or permanent repercussions as determined by other
6667
members of the project's leadership.
6768

6869
## Attribution
6970

70-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at [http://contributor-covenant.org/version/1/4][version]
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72+
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
7273

7374
[homepage]: http://contributor-covenant.org
7475
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ will be run to ensure changes do not break current functionality.
3333
Changes are more likely to be approve if they:
3434

3535
- Include tests for new functionality,
36-
- Are accompanied with a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
36+
- Are accompanied with a [good commit
37+
message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
3738
- Contain few commits (preferably a single commit),
3839
- Do not contain merge commits,
3940
- Maintain backward compatibility.
File renamed without changes.

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
SHELL := bash
2+
.ONESHELL:
3+
.SHELLFLAGS := -eu -o pipefail -c
4+
.DEFAULT_GOAL := check
5+
.DELETE_ON_ERROR:
6+
MAKEFLAGS += --warn-undefined-variables
7+
MAKEFLAGS += --no-builtin-rules
8+
TERRAFORM := terraform
9+
10+
ifeq ($(origin .RECIPEPREFIX), undefined)
11+
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
12+
endif
13+
.RECIPEPREFIX =
14+
15+
.PHONY: help
16+
help:
17+
@echo "Usage: make <target>"
18+
@echo
19+
@echo "Targets:"
20+
@echo " init Initialize the Terraform working directory"
21+
@echo " check Check if the configuration is well formatted (default)"
22+
@echo " format Format the configuration"
23+
@echo " validate Validate the configuration"
24+
@echo " clean Clean the Terraform working directory"
25+
26+
.PHONY: init
27+
init:
28+
$(TERRAFORM) init -backend=false
29+
30+
.PHONY: check
31+
check:
32+
$(TERRAFORM) fmt -check -recursive
33+
34+
.PHONY: format
35+
format:
36+
$(TERRAFORM) fmt -recursive
37+
38+
.PHONY: validate
39+
validate: init
40+
$(TERRAFORM) validate
41+
42+
.PHONY: clean
43+
clean:
44+
@rm -rf .terraform

0 commit comments

Comments
 (0)