From c528f49deb4eff3e56235a5362122744b44707ac Mon Sep 17 00:00:00 2001 From: Said Sef Date: Sat, 17 Dec 2022 11:01:34 +0000 Subject: [PATCH] Added CI workflow checks for pre-commit (#12) --- .pre-commit-config.yaml | 25 ++++++++++++++++--------- README.md | 5 ++++- TERRAFORM.md | 4 ++-- exmaples/remote/main.tf | 17 ++++++++++------- outputs.tf | 6 +++--- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6772b57..efc5d78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,15 +2,22 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.77.0 hooks: - - id: terraform_fmt - - id: terraform_tflint - - id: terraform_validate + - id: terraform_fmt + - id: terraform_tflint + - id: terraform_validate - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - - id: check-case-conflict - - id: check-merge-conflict - - id: check-vcs-permalinks - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace + - id: check-added-large-files + - id: check-byte-order-marker + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-vcs-permalinks + - id: check-yaml + - id: detect-aws-credentials + args: [--allow-missing-credentials] + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace diff --git a/README.md b/README.md index 1a510a8..af9ed2b 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,10 @@ module "gitlab_oidc" { attach_read_only_policy = true gitlab_organisation = "saidsef" - gitlab_repositories = [{ name = "terraform-aws-gitlab-oidc", branches = ["main", "pr-*", "*pull*", "*"] }] + gitlab_repositories = [{ + name = "terraform-aws-gitlab-oidc", + branches = ["main", "pr-*", "*pull*", "*"] + }] tags = var.tags } ``` diff --git a/TERRAFORM.md b/TERRAFORM.md index aa1d241..0ed17df 100644 --- a/TERRAFORM.md +++ b/TERRAFORM.md @@ -54,7 +54,7 @@ No modules. | Name | Description | |------|-------------| -| [repository](#output\_repository) | GitLab repository and branches | +| [repositories](#output\_repositories) | List of GitLab repositories and branches | | [role\_arn](#output\_role\_arn) | AWS IAM role ARN | | [role\_id](#output\_role\_id) | AWS IAM role ID | -| [thumbprint](#output\_thumbprint) | GitLab certificates thumbprint | +| [thumbprint](#output\_thumbprint) | GitLab certificates thumbprints | diff --git a/exmaples/remote/main.tf b/exmaples/remote/main.tf index 2948794..2fa94b5 100644 --- a/exmaples/remote/main.tf +++ b/exmaples/remote/main.tf @@ -6,13 +6,16 @@ module "gitlab_oidc" { source = "saidsef/gitlab-oidc/aws" version = ">= 1" - attach_admin_policy = true - attach_read_only_policy = true - create_oidc_provider = true - enabled = true - force_detach_policies = false - gitlab_organisation = "saidsef" - gitlab_repositories = [{ name = "terraform-aws-gitlab-oidc", branches = ["main", "pr-*", "*pull*", "*"] }] + attach_admin_policy = true + attach_read_only_policy = true + create_oidc_provider = true + enabled = true + force_detach_policies = false + gitlab_organisation = "saidsef" + gitlab_repositories = [{ + name = "terraform-aws-gitlab-oidc", + branches = ["main", "pr-*", "*pull*", "*"] + }] iam_role_name = "gitlab-runner" iam_role_path = "/" iam_role_permissions_boundary = "" diff --git a/outputs.tf b/outputs.tf index fb64baf..672bf39 100644 --- a/outputs.tf +++ b/outputs.tf @@ -10,14 +10,14 @@ output "role_arn" { description = "AWS IAM role ARN" } -output "repository" { +output "repositories" { value = local.repositories_branches sensitive = false - description = "GitLab repository and branches" + description = "List of GitLab repositories and branches" } output "thumbprint" { value = [for fingerprint in data.tls_certificate.provider.certificates : fingerprint.sha1_fingerprint] sensitive = false - description = "GitLab certificates thumbprint" + description = "GitLab certificates thumbprints" }