Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add support for autoformatting YAML and spell checking via pre-commit hooks #1874

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Steps to reproduce the behavior:
<!-- Have you cleared the local cache (see Notice section above)? -->
<!-- List steps in order that led up to the issue you encountered -->

## Expected behaviour
## Expected behavior

<!-- A clear and concise description of what you expected to happen -->

## Actual behaviour
## Actual behavior

<!-- A clear and concise description of what actually happened -->

Expand Down
41 changes: 25 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
repos:
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.3.0
hooks:
- id: cspell
args: [--exclude, 'ADOPTERS.md', --exclude, '.pre-commit-config.yaml', --exclude, '.gitignore', --exclude, '*.drawio', --exclude, 'mkdocs.yml', --exclude, '.helmignore', --exclude, '.github/workflows/*', --exclude, 'patterns/istio-multi-cluster/*', --exclude, 'patterns/blue-green-upgrade/*']
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --offset, '2', --preserve-quotes]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: ['--markdown-linebreak-ext=md']
- id: end-of-file-fixer
- id: check-merge-conflict
- id: detect-private-key
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
args: [--allow-missing-credentials]
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.86.0
hooks:
- id: terraform_fmt
- id: terraform_docs
args:
- '--args=--lockfile=false'
- --args=--lockfile=false
- id: terraform_tflint
args:
- '--args=--only=terraform_deprecated_interpolation'
- '--args=--only=terraform_deprecated_index'
- '--args=--only=terraform_unused_declarations'
- '--args=--only=terraform_comment_syntax'
- '--args=--only=terraform_documented_outputs'
- '--args=--only=terraform_documented_variables'
- '--args=--only=terraform_typed_variables'
- '--args=--only=terraform_module_pinned_source'
- '--args=--only=terraform_naming_convention'
- '--args=--only=terraform_required_version'
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_unused_required_providers'
- '--args=--only=terraform_workspace_remote'
- --args=--only=terraform_deprecated_interpolation
- --args=--only=terraform_deprecated_index
- --args=--only=terraform_unused_declarations
- --args=--only=terraform_comment_syntax
- --args=--only=terraform_documented_outputs
- --args=--only=terraform_documented_variables
- --args=--only=terraform_typed_variables
- --args=--only=terraform_module_pinned_source
- --args=--only=terraform_naming_convention
- --args=--only=terraform_required_version
- --args=--only=terraform_required_providers
- --args=--only=terraform_unused_required_providers
- --args=--only=terraform_workspace_remote
- id: terraform_validate
exclude: (docs|modules)
6 changes: 6 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dictionaryDefinitions:
- name: bpWords
path: ./docs/cSpell_dict.txt
addWords: true
dictionaries:
- bpWords
161 changes: 161 additions & 0 deletions docs/cSpell_dict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
acmpca
acmca_arn
addrs
adot
agones
akuity
algbw
ALLOWVOLUMEEXPANSION
amazonlinux
apigatewayv2
apiextensions
apiversion
applicationset
appsets
argocd
argoproj
athenaaccess
athenacurcfn
autoscaler
awscli
awscliv2
awslabs
awspca
awspcaclusterissuers
basepath
billingreports
bootstrappers
boto
bottlerocket
busbw
cacerts
cainjector
chdir
cidrsubnet
ciliumnetworkpolicy
clusterip
clusterissuer
clusterrole
clusterrolebinding
clusterwide
cncf
compat
configmap
concat
containerd
coredns
cuda
customresourcedefinition
crossplane
crds
curlimages
cwlogs
daemonset
dcgm
distro
ecrpublic
ecsdemo
ecsfrontend
elbv
eksctl
eksvpc
emrcontainers
errexit
eventbridge
externaldns
externalsecrets
externalsnat
fargate
fileexists
finalizer
finalizers
flblogs
fluentbit
gameserver
gameservers
gavinbunney
gitops
helloworld
heptio
identitystore
iedn
iezn
ingressgateway
instanceids
ipam
irsa
istio
istiod
istioing
jsonencode
karpenter
kiali
kubeconfig
kubecost
kubeflow
kubelet
kyverno
libfabric
logtag
loglevel
makefiles
maxport
minport
mkdocs
mktemp
mountpoint
mpijob
mpijobs
mtls
nccl
netcat
nics
nodegroup
nodeport
nvme
oidc
persistentvolume
pkce
pubkey
privateca
privatelink
prometheusservice
proto
readyz
reclaimpolicy
redop
replicaset
rdmap
rolearn
rollouts
rootdir
rpfilter
secretpassword
secretstore
secretuser
selfsigned
serviceaccount
SHA512WITHRSA
sleepdocs
ssoadmin
storageclass
storageclasses
tcpdump
templatefile
tfstate
tfvars
tolist
toset
velero
VOLUMEBINDINGMODE
vpclattice
webfront
wontfix
yamlencode
xlarge
xonotic
xrds
xvda
xvdb
zipkin
zipmap
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ directory of your choice.
terraform apply -auto-approve
```

For patterns that deviate from this general flow, see the pattern's respective `REAMDE.md` for more details.
For patterns that deviate from this general flow, see the pattern's respective `README.md` for more details.

!!! info "Terraform targetted apply"
!!! info "Terraform targeted apply"
Please see the [Terraform Caveats](https://aws-ia.github.io/terraform-aws-eks-blueprints/#terraform-caveats) section for details on the use of targeted Terraform apply's

3. Once all of the resources have successfully been provisioned, the following command can be used to update the `kubeconfig`
Expand Down
1 change: 0 additions & 1 deletion docs/v4-to-v5/example/v5.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ provider "kubernetes" {
# Cluster
################################################################################

#tfsec:ignore:aws-eks-enable-control-plane-logging
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 19.13"
Expand Down
12 changes: 6 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
site_name: Amazon EKS Blueprints for Terraform
docs_dir: 'docs/'
copyright: 'Copyright &copy; Amazon 2023'
site_author: 'AWS'
site_url: 'https://aws-ia.github.io/terraform-aws-eks-blueprints/'
repo_name: 'terraform-aws-eks-blueprints'
repo_url: 'https://github.com/aws-ia/terraform-aws-eks-blueprints'
docs_dir: docs/
copyright: Copyright &copy; Amazon 2023
site_author: AWS
site_url: https://aws-ia.github.io/terraform-aws-eks-blueprints/
repo_name: terraform-aws-eks-blueprints
repo_url: https://github.com/aws-ia/terraform-aws-eks-blueprints

theme:
name: material
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ metadata:
generateName: "simple-game-server-"
spec:
ports:
- name: default
portPolicy: Dynamic
containerPort: 7654
- name: default
portPolicy: Dynamic
containerPort: 7654
template:
spec:
containers:
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.3
resources:
requests:
memory: "64Mi"
cpu: "20m"
limits:
memory: "64Mi"
cpu: "20m"
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.3
resources:
requests:
memory: "64Mi"
cpu: "20m"
limits:
memory: "64Mi"
cpu: "20m"
10 changes: 5 additions & 5 deletions patterns/appmesh-mtls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ See [here](https://aws-ia.github.io/terraform-aws-eks-blueprints/getting-started
```text
NAMESPACE NAME READY STATUS RESTARTS AGE
appmesh-system appmesh-controller-7c98b87bdc-q6226 1/1 Running 0 4h44m
cert-manager cert-manager-87f5555f-tcxj7 1/1 Running 0 4h43m
cert-manager cert-manager-cainjector-8448ff8ddb-wwjsc 1/1 Running 0 4h43m
cert-manager cert-manager-webhook-5468b675b-fvdwk 1/1 Running 0 4h43m
cert-manager cert-manager-87f5555f-t1xj7 1/1 Running 0 4h43m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird

Copy link
Contributor Author

@bryantbiggs bryantbiggs Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the spell checker isn't super great - if it sees 4 or more characters in a row it will treat it as a word. so something like cert-manager-87f5555f-tcxj7 will fail spell check but if you break it up with a numeric value like cert-manager-87f5555f-t1xj7 it ignores it 🤷🏽 (looking at just the last part after the last hyphen)

cert-manager cert-manager-cainjector-8448ff8ddb-ww2sc 1/1 Running 0 4h43m
cert-manager cert-manager-webhook-5468b675b-fv2wk 1/1 Running 0 4h43m
kube-system aws-node-rf4wg 1/1 Running 0 4h43m
kube-system aws-node-skkwh 1/1 Running 0 4h43m
kube-system aws-node-sk1wh 1/1 Running 0 4h43m
kube-system aws-privateca-issuer-b6fb8c5bd-hh8q4 1/1 Running 0 4h44m
kube-system coredns-5f9f955df6-qhr6p 1/1 Running 0 4h44m
kube-system coredns-5f9f955df6-tw8r7 1/1 Running 0 4h44m
Expand Down Expand Up @@ -243,7 +243,7 @@ The full documentation for this example can be found [here](https://docs.aws.ama

```text
NAME READY STATUS RESTARTS AGE
appmesh-example-app-6946cdbdf6-gnxww 2/2 Running 0 54s
appmesh-example-app-6946cdbdf6-gn1ww 2/2 Running 0 54s
appmesh-example-app-6946cdbdf6-nx9tg 2/2 Running 0 54s
```

Expand Down
4 changes: 2 additions & 2 deletions patterns/aws-vpc-cni-network-policy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ See [here](https://aws-ia.github.io/terraform-aws-eks-blueprints/getting-started
```text
NAMESPACE NAME READY STATUS RESTARTS AGE
[...]
client client-xlffc 1/1 Running 0 5m19s
client client-xlf2c 1/1 Running 0 5m19s
[...]
management-ui management-ui-qrb2g 1/1 Running 0 5m24s
stars backend-sz87q 1/1 Running 0 5m23s
stars frontend-cscnf 1/1 Running 0 5m21s
stars frontend-c1cnf 1/1 Running 0 5m21s
[...]
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ spec:
role: backend
spec:
containers:
- name: backend
image: calico/star-probe:v0.1.0
imagePullPolicy: Always
command:
- probe
- --http-port=6379
- --urls=http://frontend.stars:80/status,http://backend.stars:6379/status,http://client.client:9000/status
ports:
- containerPort: 6379
- name: backend
image: calico/star-probe:v0.1.0
imagePullPolicy: Always
command:
- probe
- --http-port=6379
- --urls=http://frontend.stars:80/status,http://backend.stars:6379/status,http://client.client:9000/status
ports:
- containerPort: 6379
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: stars
spec:
ports:
- port: 6379
targetPort: 6379
- port: 6379
targetPort: 6379
selector:
role: backend
Loading
Loading