Skip to content

Commit

Permalink
chore(pre-commit): update linting INPRO-1444
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzlyn committed Dec 7, 2022
1 parent ce6f502 commit e1df12d
Show file tree
Hide file tree
Showing 18 changed files with 248 additions and 21 deletions.
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Editor configuration, see http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down
30 changes: 15 additions & 15 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"enabled": true,
"semanticCommits": "enabled",
"dependencyDashboard": true,
"dependencyDashboardTitle": ":robot: Renovate Dashboard",
"suppressNotifications": ["prIgnoreNotification"],
"rebaseWhen": "conflicted",
"labels": ["dependencies"],
"packageRules": [
enabled: true,
semanticCommits: "enabled",
dependencyDashboard: true,
dependencyDashboardTitle: ":robot: Renovate Dashboard",
suppressNotifications: ["prIgnoreNotification"],
rebaseWhen: "conflicted",
labels: ["dependencies"],
packageRules: [
{
"matchPackagePatterns": ["eslint"],
"labels": ["linting"]
matchPackagePatterns: ["eslint"],
labels: ["linting"],
},
{
"matchDepTypes": ["optionalDependencies"],
"addLabels": ["optional"]
}
]
}
matchDepTypes: ["optionalDependencies"],
addLabels: ["optional"],
},
],
}
26 changes: 26 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
default: true

# MD013/line-length - Line length
MD013:
# Number of characters
line_length: 240
# Number of characters for headings
heading_line_length: 80
# Number of characters for code blocks
code_block_line_length: 120
# Include code blocks
code_blocks: true
# Include tables
tables: true
# Include headings
headings: true
# Include headings
headers: true
# Strict length checking
strict: false
# Stern length checking
stern: false

# MD033/no-inline-html - Inline HTML disabled because of tf-docs
MD033: false
92 changes: 92 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
fail_fast: false
default_stages:
- commit
- push

repos:
- repo: https://github.com/terraform-docs/terraform-docs
rev: v0.16.0
hooks:
- id: terraform-docs-go
args:
- --config
- .terraform-docs.yaml
- --output-file
- README.md
- .

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.0
hooks:
- id: terraform_fmt
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
# - id: terraform_tfsec
# files: ^infra/terraform
# - id: terraform_validate

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-added-large-files
args:
- --maxkb=100
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-symlinks
- id: check-xml
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
args:
- --fix=auto
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md

- repo: https://github.com/adrienverge/yamllint
rev: v1.28.0
hooks:
- id: yamllint
args:
- --config-file
- .yamllint.config.yaml

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.1
hooks:
- id: remove-crlf
- id: remove-tabs

- repo: https://github.com/sirosen/fix-smartquotes
rev: 0.2.0
hooks:
- id: fix-smartquotes

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.32.2
hooks:
- id: markdownlint-fix
args:
- --config
- .markdownlint.yaml

- repo: https://github.com/k8s-at-home/sops-pre-commit
rev: v2.1.1
hooks:
- id: forbid-secrets

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: prettier
args:
- --ignore-path
- .prettierignore
- --config
- .prettierrc.yaml
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.sops.*
**/.terraform/**
terraform.tfstate*
5 changes: 5 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
trailingComma: "es5"
tabWidth: 2
semi: false
singleQuote: false
36 changes: 36 additions & 0 deletions .terraform-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
formatter: markdown
header-from: main.tf

sections:
hide-all: false
hide: []
show-all: true
show: []

output:
file: "README.md"
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
check: false

output-values:
enabled: false
from: ""

sort:
enabled: true
by: required

settings:
anchor: true
color: true
default: true
escape: true
indent: 2
required: true
sensitive: true
type: true
18 changes: 18 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
config {
force = false
disabled_by_default = false
}

rule "terraform_module_pinned_source" {
enabled = true
style = "flexible"
default_branches = ["main", "master", "default", "develop"]
}

rule "terraform_required_providers" {
enabled = false
}

rule "terraform_required_version" {
enabled = false
}
30 changes: 30 additions & 0 deletions .yamllint.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# see https://yamllint.readthedocs.io/en/stable/index.html for more options
extends: default
rules:
truthy:
allowed-values: ["true", "false", "on", "yes"]

line-length:
max: 120
level: warning

braces:
min-spaces-inside: 0
max-spaces-inside: 1

brackets:
min-spaces-inside: 0
max-spaces-inside: 0

indentation:
spaces: 2
indent-sequences: consistent
check-multi-line-strings: false

document-start:
present: true
level: error

comments:
min-spaces-from-content: 1
19 changes: 15 additions & 4 deletions examples/example-provider-authentication-with-tfvars/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
# Example Provider Authentication

This folder contains an example how to implement the GSuite Authentication for Terraform.

## Google Cloud Service account

### Setup Service Account

[Google SDK Documentation about Delegation](https://developers.google.com/admin-sdk/directory/v1/guides/delegation)

Go to [IAM service accounts](https://console.developers.google.com/iam-admin/serviceaccounts) and create a Service account.
* enter Service account name
* add yourself to 'Grant users access to this service account'

- enter Service account name
- add yourself to 'Grant users access to this service account'

### Add key

In the Service account overview open the 'Actions' menu on the right of the dedicated service account and choose **Manage keys**. Click on 'Add key' and create a new key in JSON format, this key will be used for Terraform.
Go back to Details and copy the Unique ID.

### Add service account to domain-wide delegation for GWorkspace

Go to [Google Admin console Domain wide delegation](https://admin.google.com/ac/owl/domainwidedelegation).

Get the Service account with the ID provided before (Service account details), then add the following oauth scopes:
```
https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/admin.directory.userschema, https://www.googleapis.com/auth/admin.directory.group, https://www.googleapis.com/auth/apps.groups.settings

```console
https://www.googleapis.com/auth/admin.directory.user,
https://www.googleapis.com/auth/admin.directory.userschema,
https://www.googleapis.com/auth/admin.directory.group,
https://www.googleapis.com/auth/apps.groups.settings
```

### Provide Service account credentials to Terraform Provider
Expand Down
1 change: 1 addition & 0 deletions examples/example-with-google-buckets/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Example Usage with Google Buckets

These templates show an example of how to use the terraform-gsuite-user-group-management module with Google Buckets as data source.
The yaml files can be found in the Github repository, see [example-yaml-files](examples/example-yaml-files).
1 change: 1 addition & 0 deletions examples/example-with-local-files/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Example Usage with local files

These templates show an example of how to use the terraform-gsuite-user-group-management module with local files as data source.
The yaml files can be found in the Github repository, see [example-yaml-files](examples/example-yaml-files).
1 change: 1 addition & 0 deletions examples/example-yaml-files/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Example YAML files

These templates show an example of how the terraform-gsuite-user-group-management module expects the data structure. Those YAML files can be used as data source for the module. Check out the other examples on how to provide them.
1 change: 1 addition & 0 deletions examples/example-yaml-files/group_settings.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# ---------------------------------------------------------------------------------------------------------------------
# GOOGLE GROUP SETTINGS
# ---------------------------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/example-yaml-files/groups.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# ---------------------------------------------------------------------------------------------------------------------
# GOOGLE GROUP
# ---------------------------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/example-yaml-files/users.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# ---------------------------------------------------------------------------------------------------------------------
# GOOGLE USER WITH GROUP MEMBERSHIPS
# ---------------------------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/example-yaml-files/users_external.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# ---------------------------------------------------------------------------------------------------------------------
# EXTERNAL USER WITH GROUP MEMBERSHIPS
# ---------------------------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions modules/users_external_to_groups/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Module for adding external users to groups

This module is optional. For details on how to use it check [examples](examples/).

0 comments on commit e1df12d

Please sign in to comment.