From 5f62dde30d25d723d6bdcbfd13956f0eb64eef02 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sun, 25 Feb 2024 12:46:45 +0100 Subject: [PATCH] chore(lint): add pre-commit hook --- .gitignore | 5 ++--- .pre-commit-config.yaml | 20 ++++++++++++++++++++ LICENSE | 2 +- README.md | 42 ++++++++++++++++++++++++++++++++++++++++- main.tf | 2 +- variables.tf | 2 +- 6 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index a9e8a0c..3e71225 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,8 @@ crash.log crash.*.log # Exclude all .tfvars files, which are likely to contain sensitive data, such as -# password, private keys, and other secrets. These should not be part of version -# control as they are data points which are potentially sensitive and subject +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject # to change depending on the environment. *.tfvars *.tfvars.json @@ -33,4 +33,3 @@ override.tf.json # Ignore CLI configuration files .terraformrc terraform.rc - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..668570f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.86.0 + hooks: + - id: terraform_fmt + - id: terraform_docs + args: + - "--hook-config=--path-to-file=README.md" + - "--hook-config=--add-to-existing-file=true" + - "--hook-config=--create-file-if-not-exist=true" + - "--args=--escape=false" + - "--args=--lockfile=false" + - "--args=--indent 3" + - "--args=--show all" + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer diff --git a/LICENSE b/LICENSE index c9a37e5..475d657 100644 --- a/LICENSE +++ b/LICENSE @@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 86d71ce..628db0f 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,44 @@ No modules. ## Outputs No outputs. - \ No newline at end of file + +### Requirements + +No requirements. + +### Providers + +| Name | Version | +|------|---------| +| [consul](#provider_consul) | n/a | +| [nomad](#provider_nomad) | n/a | + +### Modules + +No modules. + +### Resources + +| Name | Type | +|------|------| +| [consul_intention.this](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/resources/intention) | resource | +| [consul_key_prefix.this](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/resources/key_prefix) | resource | +| [nomad_csi_volume.this](https://registry.terraform.io/providers/hashicorp/nomad/latest/docs/resources/csi_volume) | resource | +| [nomad_csi_volume_registration.this](https://registry.terraform.io/providers/hashicorp/nomad/latest/docs/resources/csi_volume_registration) | resource | +| [nomad_job.this](https://registry.terraform.io/providers/hashicorp/nomad/latest/docs/resources/job) | resource | + +### Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [consul_intentions](#input_consul_intentions) | List of intentions associated with the job(s) |
map(object({
source_name = string
destination_name = string
action = string
}))
| `{}` | no | +| [consul_kv](#input_consul_kv) | List key/value pairs to put at a specific prefix (mainly for traefik) | `map(any)` | `{}` | no | +| [jobs](#input_jobs) | The list of jobs to deploy | `map(string)` | `{}` | no | +| [jobs_variables](#input_jobs_variables) | Map of object to pass variables to the nomad job(s). Key is the job's name, value is a map of variables and their values | `map(map(string))` | `{}` | no | +| [nfs_volumes](#input_nfs_volumes) | List of nfs volumes associated to the job(s) |
map(object({
plugin_id = string
namespace = string
capability = map(string)
context = map(string)
mount_options = object({
fs_type = string
mount_flags = list(string)
})
}))
| `{}` | no | +| [volumes](#input_volumes) | List of volumes associated to the job(s) |
map(object({
plugin_id = string
namespace = string
capacity_min = string
capacity_max = string
capability = map(string)
parameters = map(string)
secrets = map(string)
}))
| `{}` | no | + +### Outputs + +No outputs. + diff --git a/main.tf b/main.tf index ab14d77..a4217be 100644 --- a/main.tf +++ b/main.tf @@ -65,4 +65,4 @@ resource "consul_intention" "this" { source_name = each.value.source_name destination_name = each.value.destination_name action = each.value.action -} \ No newline at end of file +} diff --git a/variables.tf b/variables.tf index dc9b6f6..c099839 100644 --- a/variables.tf +++ b/variables.tf @@ -54,4 +54,4 @@ variable "consul_intentions" { })) description = "List of intentions associated with the job(s)" default = {} -} \ No newline at end of file +}