Skip to content

Commit dca1145

Browse files
committed
chore(project): setup the project
1 parent d7e03d6 commit dca1145

File tree

8 files changed

+377
-0
lines changed

8 files changed

+377
-0
lines changed

.github/CODEOWNERS

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

.github/renovate.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"github>renovatebot/.github"
5+
],
6+
"platform": "github",
7+
"platformAutomerge": true,
8+
"branchPrefix": "fix/deps/",
9+
"addLabels": [
10+
"deps",
11+
"security"
12+
],
13+
"assignees": [
14+
"timoa"
15+
],
16+
"packageRules": [
17+
{
18+
"description": "Automerge renovate minor and patch updates",
19+
"matchPackageNames": [
20+
"renovate/renovate"
21+
],
22+
"matchUpdateTypes": [
23+
"minor",
24+
"patch"
25+
],
26+
"automerge": true,
27+
"branchTopic": "{{{depNameSanitized}}}-{{{currentValue}}}"
28+
},
29+
{
30+
"description": "Allow updates after 7 days (exclude renovate)",
31+
"excludePackageNames": [
32+
"renovate/renovate"
33+
],
34+
"separateMinorPatch": true,
35+
"stabilityDays": 7
36+
}
37+
]
38+
}

.github/workflows/code-review.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Code Review
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
7+
# -- LINT -------------------------------------------------------------------
8+
tflint:
9+
name: TFLint
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
TF_VAR_tenancy_ocid: ${{secrets.OCI_TENANCY_OCID}}
14+
TF_VAR_user_ocid: ${{secrets.OCI_USER_OCID}}
15+
TF_VAR_fingerprint: ${{secrets.OCI_FINGERPRINT}}
16+
TF_VAR_private_key: ${{secrets.OCI_PRIVATE_KEY}}
17+
TF_VAR_region: ${{secrets.OCI_REGION}}
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
22+
23+
# Install latest Terraform manually as
24+
# Docker-based GitHub Actions are
25+
# slow due to lack of caching
26+
# Note: Terraform is not needed for tflint
27+
- name: Install Terraform
28+
run: |
29+
brew install terraform
30+
31+
# Run init to get module code to be able to use `--module`
32+
- name: Terraform init
33+
run: |
34+
terraform init
35+
36+
# Run TFLint
37+
- name: tflint with reviewdog output on the PR
38+
uses: reviewdog/action-tflint@46e609666b039b775a150e84781ef79ea90089a8 # tag=v1.17.0
39+
40+
# -- SECURITY ---------------------------------------------------------------
41+
tfsec:
42+
name: TFSec
43+
runs-on: ubuntu-latest
44+
45+
env:
46+
TF_VAR_tenancy_ocid: ${{secrets.OCI_TENANCY_OCID}}
47+
TF_VAR_user_ocid: ${{secrets.OCI_USER_OCID}}
48+
TF_VAR_fingerprint: ${{secrets.OCI_FINGERPRINT}}
49+
TF_VAR_private_key: ${{secrets.OCI_PRIVATE_KEY}}
50+
TF_VAR_region: ${{secrets.OCI_REGION}}
51+
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
55+
56+
# Run TFSec
57+
- name: Run tfsec with reviewdog output on the PR
58+
uses: reviewdog/action-tfsec@3f1d245c545329b13061259c2f126305893ad138 # tag=v1.15.0

.github/workflows/terraform.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Terraform
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
# -- TESTS ------------------------------------------------------------------
8+
tests:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
TF_VAR_tenancy_ocid: ${{secrets.OCI_TENANCY_OCID}}
13+
TF_VAR_user_ocid: ${{secrets.OCI_USER_OCID}}
14+
TF_VAR_fingerprint: ${{secrets.OCI_FINGERPRINT}}
15+
TF_VAR_private_key: ${{secrets.OCI_PRIVATE_KEY}}
16+
TF_VAR_region: ${{secrets.OCI_REGION}}
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
21+
22+
- name: Setup Terraform
23+
uses: hashicorp/setup-terraform@17d4c9b8043b238f6f35641cdd8433da1e6f3867 # tag=v2.0.0
24+
25+
- name: Terraform Format
26+
id: fmt
27+
run: terraform fmt -check
28+
continue-on-error: true
29+
30+
- name: Terraform Init
31+
id: init
32+
run: terraform init
33+
34+
- name: Terraform Plan
35+
id: apply
36+
run: terraform plan
37+
38+
# -- SAST SCAN --------------------------------------------------------------
39+
code-security:
40+
runs-on: ubuntu-latest
41+
needs: tests
42+
# Skip any PR created by dependabot to avoid permission issues
43+
if: (github.actor != 'dependabot[bot]')
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
48+
49+
- name: Perform Scan
50+
uses: ShiftLeftSecurity/scan-action@master
51+
52+
env:
53+
WORKSPACE: https://github.com/${{ github.repository }}/blob/${{ github.sha }}
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
SCAN_ANNOTATE_PR: true
56+
57+
- uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # tag=v3.0.0
58+
with:
59+
name: reports
60+
path: reports
61+
62+
# -- DOCUMENTATION ----------------------------------------------------------
63+
documentation:
64+
runs-on: ubuntu-latest
65+
needs: tests
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
70+
71+
- name: Terraform Docs
72+
uses: terraform-docs/gh-actions@f6d59f89a280fa0a3febf55ef68f146784b20ba0 # tag=v1.0.0
73+
with:
74+
working-dir: .
75+
output-file: USAGE.md
76+
output-method: inject
77+
git-push: "true"
78+
git-commit-message: "chore(docs): update Terraform docs"
79+
80+
# -- RELEASE ----------------------------------------------------------------
81+
release:
82+
runs-on: ubuntu-latest
83+
needs:
84+
- tests
85+
- code-security
86+
- documentation
87+
if: github.ref == 'refs/heads/main'
88+
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
92+
with:
93+
ref: 'main' # Force checkout of main branch to avoid caching from previous jobs
94+
persist-credentials: false
95+
96+
- name: Semantic Release
97+
uses: cycjimmy/semantic-release-action@v3
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
repos:
2+
#
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.1.0
5+
hooks:
6+
- id: check-yaml ### Control YAML format
7+
- id: end-of-file-fixer ### Fix end of file with one line
8+
- id: trailing-whitespace ### Remove end of line spaces
9+
- id: check-added-large-files ### Check files size to add only 500ko max
10+
- id: check-merge-conflict ### Check if there is already merge conflict(s)
11+
- id: detect-private-key ### Detect private keys
12+
13+
# Terraform
14+
- repo: https://github.com/antonbabenko/pre-commit-terraform
15+
rev: v1.62.3
16+
hooks:
17+
- id: terraform_fmt ### Format the Terraform files
18+
- id: terraform_validate ### Validate the Terraform project / module
19+
- id: terraform_tflint ### Lint the Terraform files following HashiCorp recommandations
20+
21+
# Checkov
22+
- repo: https://github.com/bridgecrewio/checkov.git
23+
rev: '2.0.917'
24+
hooks:
25+
- id: checkov ### Check misconfiguration and security issues
26+
27+
# Conventional Commit
28+
- repo: https://github.com/compilerla/conventional-pre-commit
29+
rev: v1.2.0
30+
hooks:
31+
- id: conventional-pre-commit ### Check if the commit message is compliant with the conventional commit style
32+
stages: [commit-msg]

.releaserc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"repositoryUrl": "https://github.com/timoa/terraform-oci-vscode-server.git",
3+
"branches": [
4+
"main"
5+
],
6+
"tagFormat": "v${version}",
7+
"plugins": [
8+
[
9+
"@semantic-release/commit-analyzer",
10+
{
11+
"preset": "angular",
12+
"releaseRules": [
13+
{
14+
"type": "docs",
15+
"release": "patch"
16+
},
17+
{
18+
"type": "refactor",
19+
"release": "patch"
20+
},
21+
{
22+
"type": "test",
23+
"release": "patch"
24+
},
25+
{
26+
"type": "style",
27+
"release": "patch"
28+
}
29+
],
30+
"parserOpts": {
31+
"noteKeywords": [
32+
"BREAKING CHANGE",
33+
"BREAKING CHANGES",
34+
"BREAKING"
35+
]
36+
}
37+
}
38+
],
39+
[
40+
"@semantic-release/release-notes-generator",
41+
{
42+
"preset": "angular",
43+
"parserOpts": {
44+
"noteKeywords": [
45+
"BREAKING CHANGE",
46+
"BREAKING CHANGES",
47+
"BREAKING"
48+
]
49+
}
50+
}
51+
],
52+
[
53+
"@semantic-release/changelog",
54+
{
55+
"changelogFile": "CHANGELOG.md"
56+
}
57+
],
58+
[
59+
"@semantic-release/git",
60+
{
61+
"assets": [
62+
"CHANGELOG.md",
63+
"README.md"
64+
]
65+
}
66+
],
67+
[
68+
"@semantic-release/github", {
69+
"assignees": "timoa"
70+
}
71+
]
72+
]
73+
}

.terraform-docs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
formatter: markdown table
2+
3+
sections:
4+
hide:
5+
- providers
6+
7+
output:
8+
file: "USAGE.md"
9+
mode: inject
10+
11+
sort:
12+
enabled: false
13+
14+
settings:
15+
anchor: true
16+
color: true
17+
default: true
18+
description: true
19+
escape: true
20+
indent: 2
21+
required: true
22+
sensitive: true
23+
type: true

.tflint.hcl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
config {
2+
module = true
3+
force = true
4+
disabled_by_default = false
5+
}
6+
7+
rule "terraform_deprecated_interpolation" {
8+
enabled = true
9+
}
10+
11+
rule "terraform_deprecated_index" {
12+
enabled = true
13+
}
14+
15+
rule "terraform_unused_declarations" {
16+
enabled = true
17+
}
18+
19+
rule "terraform_comment_syntax" {
20+
enabled = true
21+
}
22+
23+
rule "terraform_documented_outputs" {
24+
enabled = true
25+
}
26+
27+
rule "terraform_documented_variables" {
28+
enabled = true
29+
}
30+
31+
rule "terraform_typed_variables" {
32+
enabled = true
33+
}
34+
35+
rule "terraform_naming_convention" {
36+
enabled = true
37+
}
38+
39+
rule "terraform_required_version" {
40+
enabled = true
41+
}
42+
43+
rule "terraform_required_providers" {
44+
enabled = true
45+
}
46+
47+
rule "terraform_unused_required_providers" {
48+
enabled = true
49+
}
50+
51+
rule "terraform_standard_module_structure" {
52+
enabled = true
53+
}

0 commit comments

Comments
 (0)