diff --git a/.chglog/config.yml b/.chglog/config.yml index b81b240..224c09c 100644 --- a/.chglog/config.yml +++ b/.chglog/config.yml @@ -2,7 +2,7 @@ style: github template: CHANGELOG.tpl.md info: title: CHANGELOG - repository_url: https://github.com/hadenlabs/terraform-module-template + repository_url: https://github.com/hadenlabs/terraform-cloudflare options: commits: filters: diff --git a/.ci/config/.terraform-docs.yml b/.ci/config/.terraform-docs.yml index c42d613..6878c64 100644 --- a/.ci/config/.terraform-docs.yml +++ b/.ci/config/.terraform-docs.yml @@ -1,8 +1,8 @@ -formatter: 'markdown' # this is required -version: '' +formatter: "markdown" # this is required +version: "" header-from: main.tf -footer-from: '' +footer-from: "" recursive: enabled: false @@ -12,10 +12,10 @@ sections: hide: [] show: [] -content: '' +content: "" output: - file: 'docs/include/terraform.md' + file: "docs/include/terraform.md" mode: replace template: |- @@ -26,7 +26,7 @@ output: output-values: enabled: false - from: '' + from: "" sort: enabled: true diff --git a/.codespell-ignores b/.ci/linters/.codespell-ignores similarity index 100% rename from .codespell-ignores rename to .ci/linters/.codespell-ignores diff --git a/.ci/linters/.eslintrc.js b/.ci/linters/.eslintrc.js index ce35ce3..41d2518 100644 --- a/.ci/linters/.eslintrc.js +++ b/.ci/linters/.eslintrc.js @@ -1,28 +1,28 @@ module.exports = { - parser: '@typescript-eslint/parser', + parser: "@typescript-eslint/parser", env: { node: true, es2021: true }, parserOptions: { ecmaVersion: 6, - sourceType: 'module' // Allows for the use of imports + sourceType: "module" // Allows for the use of imports }, extends: [ - 'plugin:prettier/recommended', - 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin - 'plugin:import/warnings' + "plugin:prettier/recommended", + "plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin + "plugin:import/warnings" ], - plugins: ['@typescript-eslint'], + plugins: ["@typescript-eslint"], rules: { - '@typescript-eslint/semicolon': 'off', - '@typescript-eslint/member-delimiter-style': 'off', - '@typescript-eslint/naming-convention': 'warn', - '@typescript-eslint/semi': 'off', - 'no-throw-literal': 'warn', - curly: 'warn', - eqeqeq: 'warn', - semi: 'off' + "@typescript-eslint/semicolon": "off", + "@typescript-eslint/member-delimiter-style": "off", + "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/semi": "off", + "no-throw-literal": "warn", + curly: "warn", + eqeqeq: "warn", + semi: "off" }, - ignorePatterns: ['**/*.d.ts'] + ignorePatterns: ["**/*.d.ts"] } diff --git a/.ci/linters/.gitleaks.toml b/.ci/linters/.gitleaks.toml index a9f53a8..dfdf348 100644 --- a/.ci/linters/.gitleaks.toml +++ b/.ci/linters/.gitleaks.toml @@ -161,28 +161,9 @@ title = "gitleaks config" regexes = [ '''host=HOST''', '''--private-key={{.PRIVATE_KEY_FILE}}''', + '''PASSWORD=XXXXXX''', ] -[[rules]] - description = "Email" - regex = '''[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}''' - tags = ["email"] - [rules.allowlist] - description = "ignore emails" - regexes = [ - '''[a-zA-Z0-9._%+-]+@users.noreply.github.com''', - '''[a-zA-Z0-9._%+-]+@yopmail.com''', - '''git@github.com''', - '''git@gitlab.com''', - '''slovacus@gmail.com''', - '''luis@hadenlabs.com''', - '''security@hadenlabs.com''', - '''hola@hadenlabs.com''', - '''hello@hadenlabs.com''', - '''support@hadenlbas.com''', - '''support@hadenlabs.com''', - '''dum-u@hadenlabs.com''', - ] [[rules]] description = "High Entropy" @@ -262,9 +243,11 @@ title = "gitleaks config" [whitelist] description = "image and html allowlists" paths = [ - '''^vendor/(.*?)$''', - '''^node_modules/(.*?)$''', - '''^test/fixtures/keys/(.*?)$''', + '''^vendor/''', + '''^bower_components/''', + '''^public/''', + '''^node_modules/''', + '''^theme/''', ] files = [ @@ -276,3 +259,5 @@ title = "gitleaks config" '''^sonar-project.properties$''', '''^test/fixtures/keys/.*-test.*$''', ] + + commits = [] diff --git a/.ci/linters/.golangci.yml b/.ci/linters/.golangci.yml index fec8305..2a88814 100644 --- a/.ci/linters/.golangci.yml +++ b/.ci/linters/.golangci.yml @@ -99,6 +99,7 @@ linters: - unconvert - misspell - nakedret + - unused presets: - bugs @@ -121,6 +122,9 @@ linters: - sqlclosecheck - structcheck - unparam + - deadcode + - varcheck + - asasalint # Drives todos nuts - godox diff --git a/.ci/linters/.goreleaser.yml b/.ci/linters/.goreleaser.yml index ebde353..8227a22 100644 --- a/.ci/linters/.goreleaser.yml +++ b/.ci/linters/.goreleaser.yml @@ -1,9 +1,9 @@ # This is an example goreleaser.yaml file with some sane defaults. # Make sure to check the documentation at http://goreleaser.com -project_name: terraform-module-template +project_name: terraform-cloudflare env: - GO111MODULE=on - - REPO=github.com/hadenlabs/terraform-module-template + - REPO=github.com/hadenlabs/terraform-cloudflare before: hooks: - go mod download @@ -39,7 +39,7 @@ archives: builds: - default wrap_in_directory: true - name_template: '{{.ProjectName}}-{{.Os}}-{{.Arch}}' + name_template: "{{.ProjectName}}-{{.Os}}-{{.Arch}}" format: tar.gz format_overrides: - goos: windows @@ -52,22 +52,22 @@ archives: - systemd/* # https://goreleaser.com/snapshots/ snapshot: - name_template: 'dev@{{.ShortCommit}}' + name_template: "dev@{{.ShortCommit}}" # https://goreleaser.com/checksum/ checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' + name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" algorithm: sha256 changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" release: github: owner: hadenlabs - name: terraform-module-template + name: terraform-cloudflare draft: true prerelease: auto - name_template: '{{.ProjectName}}-v{{.Version}}-{{.ShortCommit}}-{{.Date}}' + name_template: "{{.ProjectName}}-v{{.Version}}-{{.ShortCommit}}-{{.Date}}" diff --git a/.ci/linters/.lintstagedrc.js b/.ci/linters/.lintstagedrc.js index 426f4d7..3e5b49a 100644 --- a/.ci/linters/.lintstagedrc.js +++ b/.ci/linters/.lintstagedrc.js @@ -1,10 +1,10 @@ -const escape = require('shell-quote').quote +const escape = require("shell-quote").quote module.exports = { - '*.{ts,tsx,js,json,css}': (filenames) => [ + "*.{ts,tsx,js,json,css}": (filenames) => [ ...filenames.map((filename) => `prettier --check "${escape([filename])}"`), ...filenames.map((filename) => `git add "${filename}"`) ], - '*.{ts,tsx,js,jsx}': ['eslint'], - '*.{ts,tsx,css}': ['stylelint'] + "*.{ts,tsx,js,jsx}": ["eslint"], + "*.{ts,tsx,css}": ["stylelint"] } diff --git a/.ci/linters/.tflint.hcl b/.ci/linters/.tflint.hcl index 435d530..9374409 100644 --- a/.ci/linters/.tflint.hcl +++ b/.ci/linters/.tflint.hcl @@ -1,6 +1,6 @@ plugin "aws" { enabled = true - version = "0.8.0" + version = "0.27.0" source = "github.com/terraform-linters/tflint-ruleset-aws" } rule "terraform_deprecated_index" { diff --git a/.ci/linters/markdown-link-config.json b/.ci/linters/markdown-link-config.json index ddcd295..30d3adf 100644 --- a/.ci/linters/markdown-link-config.json +++ b/.ci/linters/markdown-link-config.json @@ -1,11 +1,8 @@ { - "baseUrl": "https://github.com/hadenlabs/terraform-module-template", + "baseUrl": "https://github.com/hadenlabs/terraform-cloudflare", "ignorePatterns": [ { "pattern": "^https://hadenlabs.com" - }, - { - "pattern": "^https://github.com/hadenlabs/terraform-module-template/compare" } ], "replacementPatterns": [ diff --git a/.ci/linters/prettier.config.js b/.ci/linters/prettier.config.js index db2b6d3..da525f2 100644 --- a/.ci/linters/prettier.config.js +++ b/.ci/linters/prettier.config.js @@ -1,64 +1,71 @@ module.exports = { - arrowParens: 'always', + arrowParens: "always", printWidth: 120, - proseWrap: 'preserve', + proseWrap: "preserve", semi: false, - singleQuote: true, + singleQuote: false, tabWidth: 2, - trailingComma: 'none', + trailingComma: "none", overrides: [ { - files: '{*.js?(x),*.ts?(x),*.y?(a)ml,.*.y?(a)ml,*.md,.prettierrc,.stylelintrc,.babelrc}', + files: "{*.js?(x),*.ts?(x),*.y?(a)ml,.*.y?(a)ml,*.md,.prettierrc,.stylelintrc,.babelrc}", options: { - arrowParens: 'always', + arrowParens: "always", printWidth: 100, semi: false, - singleQuote: true, - quoteProps: 'as-needed', + quoteProps: "as-needed", tabWidth: 2, - trailingComma: 'none' + trailingComma: "none" } }, { - files: '{*.json,.*.json,**/.vscode/*.json,**/tsconfig.json,**/tsconfig.*.json}', + files: "{*.lua}", options: { - parser: 'json', + printWidth: 100, + tabWidth: 2, + quoteProps: "preserve" + } + }, + + { + files: "{*.json,.*.json,**/.vscode/*.json,**/tsconfig.json,**/tsconfig.*.json}", + options: { + parser: "json", tabWidth: 2, - quoteProps: 'preserve', - singleQuote: false + quoteProps: "preserve" } }, { - files: '*.md', + files: "*.md", options: { - parser: 'markdown', + parser: "markdown", printWidth: 120, - proseWrap: 'never', + proseWrap: "never", semi: false, - trailingComma: 'none' + trailingComma: "none" } }, { - files: '*.mdx', + files: "*.mdx", options: { printWidth: 120, - proseWrap: 'never', + proseWrap: "never", semi: false, - trailingComma: 'none' + trailingComma: "none" } }, { - files: '*.{sass,scss}', + files: "*.{sass,scss}", options: { - parser: 'scss' + parser: "scss" } }, { - files: '*.less', + files: "*.less", options: { tabWidth: 4, printWidth: 80, - parser: 'less' + parser: "less" } } ] diff --git a/.dockerignore b/.dockerignore index 1d17dae..4e7aa78 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,5 @@ +.* +!.coveragerc +!.env +!.pylintrc .venv diff --git a/.editorconfig b/.editorconfig index c2bd381..51a2a62 100644 --- a/.editorconfig +++ b/.editorconfig @@ -32,7 +32,11 @@ trim_trailing_whitespace = true [*.{el}] insert_final_newline = false -[*.{el,md,mdx,yml,yaml,js,json,toml,ts,tsx,hcl,tf,graphql,hbs,sh}] +[*.{el,md,mdx,yml,yaml,js,json,toml,ts,tsx,hcl,tf,graphql,hbs,sh,lua}] +indent_style = space +indent_size = 2 + +[*.{lua}] indent_style = space indent_size = 2 diff --git a/.env.example b/.env.example index 501f48d..1cfe0f4 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ # **NOTE**: please check the following document docs/env-vars.md -APP_NAME=terraform-module-template +APP_NAME=terraform-cloudflare SONAR_URL= SONAR_TOKEN= diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b8e8d85..4d26610 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,7 +6,6 @@ Briefly describe the issue you are experiencing (or the feature you want to see - OS: {Please write here} - Python version: {Please write here} -- Python Facebook Chatbot version : {Please write here} ## Details diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d69a42f..4d36f30 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,5 +1,5 @@ --- -name: Bug report +name: 🐛 Bug report about: Create a report to help us improve labels: type/bug --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index a3ffa50..fb43ed8 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,5 +1,5 @@ --- -name: Feature request +name: 🚀 Feature request about: Suggest an idea for this project labels: type/enhancement --- diff --git a/.github/workflows/confluence.yml b/.github/workflows/confluence.yml index 8299a2c..0ec3bc8 100644 --- a/.github/workflows/confluence.yml +++ b/.github/workflows/confluence.yml @@ -1,21 +1,16 @@ name: confluence on: - workflow_run: - workflows: - - lint-code - types: - - completed + push: branches: - - develop - main tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" jobs: confluence: @@ -32,14 +27,15 @@ jobs: uses: tj-actions/changed-files@v26 with: files: | - *.md + docs/*.md files_ignore: | *.tpl.md + ^.terraform - name: Sync confluence uses: hadenlabs/action-confluence-sync@0.1.0 with: - files: '${{ steps.changed-files.outputs.all_changed_files }}' + files: "${{ steps.changed-files.outputs.all_changed_files }}" confluence_url: ${{ secrets.CONFLUENCE_BASE_URL }} confluence_username: ${{ secrets.CONFLUENCE_USER }} confluence_token: ${{ secrets.CONFLUENCE_ACCESS_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c14c04a..a75560f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,6 @@ name: lint-code on: pull_request: branches: - - develop - main push: @@ -12,11 +11,11 @@ on: - main tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b8f63c..54dfd3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,19 +1,13 @@ name: create-release on: - workflow_run: - workflows: - - sonar-scan - types: - - completed - push: tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" env: TMP_CHANGELOG_FILENAME: TMP_CHANGELOG.md diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 4d8e422..a3455b6 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -1,25 +1,20 @@ name: sonarqube on: - workflow_run: - workflows: - - lint-code - types: - - completed + push: branches: - - develop - main tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" env: - SONAR_HOST_URL: '${{ secrets.SONAR_HOST_URL }}' - SONAR_LOGIN: '${{ secrets.SONAR_LOGIN }}' + SONAR_HOST_URL: "${{ secrets.SONAR_HOST_URL }}" + SONAR_LOGIN: "${{ secrets.SONAR_LOGIN }}" jobs: sonar-scan: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03784df..e2097cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,12 +3,10 @@ name: test on: push: branches: - - develop - main pull_request: branches: - - develop - main env: diff --git a/.gitignore b/.gitignore index 1c42a58..ddd1622 100644 --- a/.gitignore +++ b/.gitignore @@ -472,6 +472,11 @@ cython_debug/ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration poetry.toml +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json ### Sonar ### #Sonar generated dir @@ -521,6 +526,12 @@ terraform.rc # Zsh completion-optimization dumpfile *zcompdump* +# Zsh history +.zsh_history + +# Zsh sessions +.zsh_sessions + # Zsh zcalc history .zcalc_history @@ -552,6 +563,7 @@ TMP_CHANGELOG.md .task .terraform.lock.hcl *.lock.hcl +*.lock *.zip .external_modules vendor diff --git a/.nvmrc b/.nvmrc index d9216d9..bb52a16 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.6.1 +v18.18.2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 790bbe0..0c1dde4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,6 @@ +ci: + autoupdate_schedule: monthly + default_stages: - commit exclude: > @@ -12,28 +15,30 @@ exclude: > repos: - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.3.0 hooks: - id: codespell - args: [--ignore-words=.codespell-ignores] + args: + - --ignore-words=.ci/linters/.codespell-ignores exclude: > (?x)^( .+\.vendor\/.*$| .+\.node_modules\/.*$| + .+\.sops.*$| .+\.lock$| go.mod| go.sum| )$ - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook - rev: v9.3.0 + rev: v9.16.0 hooks: - id: commitlint stages: [commit-msg] - additional_dependencies: ['@hadenlabs/commitlint-config'] + additional_dependencies: ["@hadenlabs/commitlint-config"] args: - --config=.ci/linters/.commitlintrc.json - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: detect-private-key files: ^(?!\.?git-crypt) @@ -69,6 +74,8 @@ repos: - --config=.ci/linters/markdown-link-config.json exclude: > (?x)^( + .+\.docs/env-vars.md$| + docs/env-vars.md$| docs\/include\/terraform.md$| .+\.tpl.md$| )$ @@ -80,7 +87,7 @@ repos: .+\.tpl.sh$| )$ args: - - --exclude=SC1071,SC1073,SC2068 + - --exclude=SC1072,SC1073,SC2068 - id: validate-toml - id: no-go-testing - id: golangci-lint @@ -90,7 +97,7 @@ repos: - id: terraform-tflint args: - - '--config=.ci/linters/.tflint.hcl' + - "--config=.ci/linters/.tflint.hcl" - id: terragrunt-fmt - id: terraform-fmt - id: terraform-tfsec diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..c8d5014 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11.5 \ No newline at end of file diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 37f0a02..0000000 --- a/Pipfile +++ /dev/null @@ -1,28 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -bridgecrew = "*" -bumpversion = "*" -doc8 = "*" -grip = "*" -isort = "*" -mkdocs = "*" -mkdocs-material = "*" -mypy = "*" -parso = "*" -pre-commit = "*" -pycodestyle = "*" -pydocstyle = "*" -pygments = "*" -pylint = "*" -pymdown-extensions = "*" -black = "*" - -[packages] - -[scripts] -test = "pytest" -update = "pre-commit autoupdate" diff --git a/README.md b/README.md index b39c9a9..bf73e5e 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,11 @@ --> -[![Latest Release](https://img.shields.io/github/release/hadenlabs/terraform-module-template)](https://github.com/hadenlabs/terraform-module-template/releases) [![Lint](https://img.shields.io/github/workflow/status/hadenlabs/terraform-module-template/lint-code)](https://github.com/hadenlabs/terraform-module-template/actions?workflow=lint-code) [![CI](https://img.shields.io/github/workflow/status/hadenlabs/terraform-module-template/ci)](https://github.com/hadenlabs/terraform-module-template/actions?workflow=ci) [![Test](https://img.shields.io/github/workflow/status/hadenlabs/terraform-module-template/test)](https://github.com/hadenlabs/terraform-module-template/actions?workflow=test) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow)](https://conventionalcommits.org) [![KeepAChangelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.0.0-orange)](https://keepachangelog.com) [![Terraform Version](https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform)](https://github.com/hashicorp/terraform/releases) +[![Latest Release](https://img.shields.io/github/release/hadenlabs/terraform-cloudflare)](https://github.com/hadenlabs/terraform-cloudflare/releases) [![Lint](https://img.shields.io/github/workflow/status/hadenlabs/terraform-cloudflare/lint-code)](https://github.com/hadenlabs/terraform-cloudflare/actions?workflow=lint-code) [![CI](https://img.shields.io/github/workflow/status/hadenlabs/terraform-cloudflare/ci)](https://github.com/hadenlabs/terraform-cloudflare/actions?workflow=ci) [![Test](https://img.shields.io/github/workflow/status/hadenlabs/terraform-cloudflare/test)](https://github.com/hadenlabs/terraform-cloudflare/actions?workflow=test) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow)](https://conventionalcommits.org) [![KeepAChangelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.0.0-orange)](https://keepachangelog.com) [![Terraform Version](https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform)](https://github.com/hashicorp/terraform/releases) -# terraform-module-template +# terraform-cloudflare -terraform-module-template for project - -### Replace name project to New Project - -```bash - agr 'terraform-module-template' 'new-project' -``` +terraform-cloudflare for project ## Requirements @@ -39,7 +33,7 @@ This is a list of plugins that need to be installed previously to enjoy all the ```hcl module "main" { - source = "hadenlabs/terraform-module-template/aws" + source = "hadenlabs/terraform-cloudflare" version = "0.0.0" } ``` @@ -49,17 +43,17 @@ Full working examples can be found in [examples](./examples) folder. ## Examples - - + + -### common +### Common ```hcl module "main" { - source = "hadenlabs/terraform-module-template/aws" + source = "hadenlabs/terraform-cloudflare/aws" version = "0.0.0" } ``` @@ -100,7 +94,7 @@ No outputs. **Got a question?** -File a GitHub [issue](https://github.com/hadenlabs/terraform-module-template/issues). +File a GitHub [issue](https://github.com/hadenlabs/terraform-cloudflare/issues). ## Contributing @@ -123,7 +117,7 @@ Using the given version number of `MAJOR.MINOR.PATCH`, we apply the following co ## Copyright -Copyright © 2018-2022 [Hadenlabs](https://hadenlabs.com) +Copyright © 2018-2024 [Hadenlabs](https://hadenlabs.com) ## Trademarks @@ -133,6 +127,6 @@ All other trademarks referenced herein are the property of their respective owne The code and styles are licensed under the LGPL-3.0 license [See project license.](LICENSE). -## Don't forget to 🌟 Star 🌟 the repo if you like terraform-module-template +## Don't forget to 🌟 Star 🌟 the repo if you like terraform-cloudflare -[Your feedback is appreciated](https://github.com/hadenlabs/terraform-module-template/issues) +[Your feedback is appreciated](https://github.com/hadenlabs/terraform-cloudflare/issues) diff --git a/SECURITY.md b/SECURITY.md index acfeba2..8affea5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,7 +1,7 @@ - - - + + + @@ -10,6 +10,6 @@ ## Reporting a Security Bug -If you think you have discovered a security issue in any of the terraform-module-template projects, we'd love to hear from you. We will take all security bugs seriously and if confirmed upon investigation we will patch it within a reasonable amount of time and release a public security bulletin discussing the impact and credit the discoverer. +If you think you have discovered a security issue in any of the terraform-cloudflare projects, we'd love to hear from you. We will take all security bugs seriously and if confirmed upon investigation we will patch it within a reasonable amount of time and release a public security bulletin discussing the impact and credit the discoverer. -There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at terraform-module-template dot org](mailto:security@hadenlabs.com). +There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at terraform-cloudflare dot org](mailto:security@hadenlabs.com). diff --git a/Taskfile.yml b/Taskfile.yml index 25ad333..bd94d6f 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,4 +1,5 @@ -version: '3' +--- +version: "3" includes: changelog: ./provision/task/changelog.yml @@ -36,14 +37,14 @@ dotenv: - .env vars: - PROJECT_NAME: terraform-module-template - GROUP_NAME: hadenlabs + PROJECT_NAME: terraform-cloudflare ORGANIZATION: hadenlabs + DOCKER_PLATFORM: linux/amd64 REVIEWERS: luismayta - PYTHON_VERSION: 3.10.6 - NODE_VERSION: 16.6.1 + PYTHON_VERSION: 3.11.5 + NODE_VERSION: 18.18.2 + TERRAFORM_VERSION: 1.8.5 GIT_IGNORES: python,node,go,zsh,sonar,java,maven,intellij+all,terraform,linux - DOCKER_PLATFORMS: linux/amd64 GOLANGCI_VERSION: 1.42.0 README_FILE: README.md GIT_IGNORES_CUSTOM: | @@ -55,6 +56,7 @@ vars: .task .terraform.lock.hcl *.lock.hcl + *.lock *.zip .external_modules vendor @@ -72,7 +74,7 @@ tasks: silent: true summary: - desc: 'Summary information' + desc: "Summary information" cmds: - echo Go available {{.GO}} - echo Python available {{.PYTHON}} @@ -81,7 +83,7 @@ tasks: silent: true check: - desc: 'Check all dependencies' + desc: "Check all dependencies" deps: - python:check - changelog:check @@ -96,7 +98,6 @@ tasks: desc: Generate Readme silent: true cmds: - - task: terraform:docs:all - >- gomplate --file {{.README_TEMPLATE}} --out {{.README_FILE}} @@ -111,11 +112,10 @@ tasks: - task: prettier:all upgrade: - run: once desc: Execute upgrade packages cmds: - - >- - pipenv run pre-commit autoupdate + - poetry update + - poetry run pre-commit autoupdate setup: desc: Setup dependences of project @@ -128,12 +128,13 @@ tasks: - task: yarn:setup - task: git:setup + test: + run: once + desc: Execute task test all + cmds: + - task: go:test + environment: desc: Setup environment of project cmds: - task: python:environment - - test: - desc: test all - cmds: - - task: go:test diff --git a/config/config.go b/config/config.go index 081e47b..5d1d2c7 100644 --- a/config/config.go +++ b/config/config.go @@ -6,8 +6,8 @@ import ( "github.com/joho/godotenv" - "github.com/hadenlabs/terraform-module-template/internal/errors" - "github.com/hadenlabs/terraform-module-template/internal/version" + "github.com/hadenlabs/terraform-cloudflare/internal/errors" + "github.com/hadenlabs/terraform-cloudflare/internal/version" ) // Config struct field. @@ -17,7 +17,7 @@ type Config struct { } const ( - applicationName = "terraform-module-template" + applicationName = "terraform-cloudflare" ) // ReadConfig read values and files for config. diff --git a/docs/commands.md b/docs/commands.md index 169345e..e1a18cc 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -1,35 +1,104 @@ - - - + + + -## Commands +# Commands + +## Poetry + +## Taskfile + +### Confluence + +#### Sync Markdown with confluence + +```{.bash} +task confluence:sync:all +``` + +### Python + +#### Format syntax code python with [black](https://github.com/psf/black) + +```{.bash} +task python:fmt -- {{file_name or path}} +``` + +### Diagrams + +#### Publish diagrams + +```{.bash} +task diagrams:publish +``` + +### Mkdocs + +#### Generate Website + +```{.bash} +task docs:build +``` + +### Changelog + +#### Generate Changelog Next Tag + +```{.bash} +task changelog:next APP_TAG={{tag name}} +``` + +#### Parameters + +| Name | Description | sample | Required | +| -------- | ------------- | ------ | :------: | +| tag name | Name next tag | 0.1.0 | yes | + +### Version + +#### Version Major + +```{.bash} +task version:major +``` + +#### Version Minor + +```{.bash} +task version:minor +``` + +#### Version Patch + +```{.bash} +task version:patch +``` ### Terragrunt -| Field | Description | -| ------ | :-----------------------: | -| REGION | region of aws | -| STAGE | stage or name environment | +| Field | Description | +| ----- | :-----------------------: | +| STAGE | stage or name environment | ```bash -task terragrunt:init REGION=us-east-1 STAGE=core +task terragrunt:init STAGE=core ``` ```bash -task terragrunt:apply REGION=us-east-1 STAGE=core +task terragrunt:apply STAGE=core ``` ```bash -task terragrunt:plan REGION=us-east-1 STAGE=core +task terragrunt:plan STAGE=core ``` ```bash -task terragrunt:destroy REGION=us-east-1 STAGE=core +task terragrunt:destroy STAGE=core ``` #### Import @@ -41,13 +110,13 @@ task terragrunt:destroy REGION=us-east-1 STAGE=core | COMMAND | command for execute with import | ```bash -task terragrunt:import REGION=us-east-1 STAGE=core COMMAND=module.repository_learn_go.github_repository.this learn-go +task terragrunt:import STAGE=core COMMAND="module.project_learn_go.gitlab_project.this group/name-repository" ``` **example** ```bash -task terragrunt:import REGION=us-east-1 STAGE=core COMMAND=module.repository_learn_go.github_repository.this learn-go +task terragrunt:import STAGE=core COMMAND="module.project_learn_go.gitlab_project.this devops/learn-go" ``` #### Module @@ -59,7 +128,7 @@ task terragrunt:import REGION=us-east-1 STAGE=core COMMAND=module.repository_lea | MODULE | module name to destroy | ```bash -task terragrunt:module:destroy REGION=us-east-1 STAGE=core MODULE=repository_eslint_config +task terragrunt:module:destroy STAGE=core MODULE=project_eslint_config ``` #### State @@ -74,12 +143,24 @@ task terragrunt:module:destroy REGION=us-east-1 STAGE=core MODULE=repository_esl task terragrunt:state REGION=us-east-1 STAGE=core COMMAND=list ``` -### Confluence +### Terraform -#### Sync Markdown with confluence +#### generate docs terraform for stage + +| Field | Description | +| ----- | :-----------------------: | +| STAGE | stage or name environment | + +```bash +task terraform:docs STAGE=core +``` + +### Python + +#### Format syntax code python with [black](https://github.com/psf/black) ```{.bash} -task mark:sync +task python:fmt -- {{file_name or path}} ``` ### Diagrams diff --git a/docs/components.md b/docs/components.md index 84aeb9a..0821723 100755 --- a/docs/components.md +++ b/docs/components.md @@ -1,7 +1,7 @@ - - - + + + diff --git a/docs/contribute/github-flow.md b/docs/contribute/github-flow.md index 370b274..0a4f300 100644 --- a/docs/contribute/github-flow.md +++ b/docs/contribute/github-flow.md @@ -1,14 +1,14 @@ - - - + + + -To contribute to terraform-module-template project on [GitHub](https://github.com/hadenlabs/terraform-module-template), We use [GitHub Flow](https://githubflow.github.io/), it means that you should branch from the main repository and contribute back by making [pull request](https://github.com/hadenlabs/terraform-module-template/pulls). +To contribute to terraform-cloudflare project on [GitHub](https://github.com/hadenlabs/terraform-cloudflare), We use [GitHub Flow](https://githubflow.github.io/), it means that you should branch from the main repository and contribute back by making [pull request](https://github.com/hadenlabs/terraform-cloudflare/pulls). GitHub Flow is very lightweight (especially compared to GitFlow). This workflow uses only two kinds of branches: @@ -23,7 +23,7 @@ For more information see [GitHub Flow](https://githubflow.github.io/) ## Getting started -To follow the instructions in this guide and start contributing to terraform-module-template project on GitHub: +To follow the instructions in this guide and start contributing to terraform-cloudflare project on GitHub: 1. **Fork** the repo on GitHub 2. **Clone** the project to your own machine @@ -31,10 +31,10 @@ To follow the instructions in this guide and start contributing to terraform-mod To synchronize with the main repository, add it to the remotes: ```bash -git remote add upstream https://github.com/hadenlabs/terraform-module-template.git +git remote add upstream https://github.com/hadenlabs/terraform-cloudflare.git ``` -Now your **upstream** points to **hadenlabs/terraform-module-template**. +Now your **upstream** points to **hadenlabs/terraform-cloudflare**. ## Branches @@ -58,7 +58,7 @@ To resolve a conflict, run the following commands. ```bash # checkout a branch you open PR from -git fetch upstream # assuming upstream is hadenlabs/terraform-module-template +git fetch upstream # assuming upstream is hadenlabs/terraform-cloudflare git merge upstream/merge_branch # Where merge_branch is a branch you open merge request against. # resolve merge requests git add changed_files @@ -70,7 +70,7 @@ Github will automatically update your pull request. ### Testing -All merge requests are automatically tested using [Github Actions](https://github.com/hadenlabs/terraform-module-template/actions). In case some tests fail, fix the issues or describe why the fix cannot be done. +All merge requests are automatically tested using [Github Actions](https://github.com/hadenlabs/terraform-cloudflare/actions). In case some tests fail, fix the issues or describe why the fix cannot be done. ### Review diff --git a/docs/contributing.md b/docs/contributing.md index b29596a..b2d2ad2 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,18 +1,18 @@ - - - + + + # How To Contribute -Contributions to terraform-module-template are welcome. +Contributions to terraform-cloudflare are welcome. Feel free to use all of the contribution options: -- Contribute to terraform-module-template repositories on [GitHub](https://github.com/hadenlabs/terraform-module-template). See [Git flow](./contribute/github-flow.md). +- Contribute to terraform-cloudflare repositories on [GitHub](https://github.com/hadenlabs/terraform-cloudflare). See [Git flow](./contribute/github-flow.md). ## Getting Started @@ -73,7 +73,7 @@ See [Git flow](./contribute/github-flow.md). ### Documentation -Documentation is a part of the terraform-module-template code base. You can find the documentation files in the `doc/` subdirectory of the [main repository](https://github.com/hadenlabs/terraform-module-template). This means that the contribution process is the same for both the source code and documentation. +Documentation is a part of the terraform-cloudflare code base. You can find the documentation files in the `doc/` subdirectory of the [main repository](https://github.com/hadenlabs/terraform-cloudflare). This means that the contribution process is the same for both the source code and documentation. ### Testing @@ -81,15 +81,15 @@ See [Testing](./testing.md). ### Code Submission -1. See if a [Pull Request](https://github.com/hadenlabs/terraform-module-template/pulls) exists +1. See if a [Pull Request](https://github.com/hadenlabs/terraform-cloudflare/pulls) exists - Add some comments or review the code to help it along - Don\'t be afraid to comment when logic needs clarification -2. Create a Fork and open a [Pull Request](https://github.com/hadenlabs/terraform-module-template/pulls) if needed +2. Create a Fork and open a [Pull Request](https://github.com/hadenlabs/terraform-cloudflare/pulls) if needed ### Code Review - Anyone can review code -- Any [Pull Request](https://github.com/hadenlabs/terraform-module-template/pulls) should be closed or merged within a week +- Any [Pull Request](https://github.com/hadenlabs/terraform-cloudflare/pulls) should be closed or merged within a week ### Code Acceptance diff --git a/docs/env-vars.md b/docs/env-vars.md index 7a0e8ff..e406562 100644 --- a/docs/env-vars.md +++ b/docs/env-vars.md @@ -1,7 +1,7 @@ - - - + + + @@ -10,3 +10,5 @@ --- ## Env Vars + +### Application diff --git a/docs/examples/common.md b/docs/examples/common.md index 67b8050..3577209 100644 --- a/docs/examples/common.md +++ b/docs/examples/common.md @@ -1,15 +1,15 @@ - - + + -### common +### Common ```hcl module "main" { - source = "hadenlabs/terraform-module-template/aws" + source = "hadenlabs/terraform-cloudflare/aws" version = "0.0.0" } ``` diff --git a/docs/index.md b/docs/index.md index ce51261..8c291f3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1 +1 @@ -# Welcome to terraform-module-template documentation +# Welcome to terraform-cloudflare documentation diff --git a/docs/releasing.md b/docs/releasing.md index 1896d3d..8a45f11 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,7 +1,7 @@ - - - + + + @@ -11,7 +11,7 @@ ## Bump a new version -Make a new version of terraform-module-template in the following steps: +Make a new version of terraform-cloudflare in the following steps: ### Generate version major diff --git a/docs/roadmap.md b/docs/roadmap.md index 4d4f612..20e20f4 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ - - + + @@ -29,7 +29,7 @@ The Roadmap is a list of all the things we're working on for the year. -You can see the corresponding projects on [terraform-module-template](https://github.com/hadenlabs/terraform-module-template) +You can see the corresponding projects on [terraform-cloudflare](https://github.com/hadenlabs/terraform-cloudflare) ## Legend @@ -53,5 +53,3 @@ You can see the corresponding projects on [terraform-module-template](https://gi ## Long Lived Initiatives These projects don't have an end date. They are something we'll continuously work towards. - -- [Better Docs](https://hadenlabs.atlassian.net/wiki) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 33a95cf..866edbd 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -2,7 +2,7 @@ ## Environment -### Wrong pre-commit with pipenv +### Wrong pre-commit with poetry Execute the next: diff --git a/docs/usage.md b/docs/usage.md index fc2844c..46480cf 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -2,7 +2,7 @@ ```hcl module "main" { - source = "hadenlabs/terraform-module-template/aws" + source = "hadenlabs/terraform-cloudflare" version = "0.0.0" } ``` diff --git a/go.mod b/go.mod index 8b40a71..20d4507 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/hadenlabs/terraform-module-template +module github.com/hadenlabs/terraform-cloudflare go 1.16 diff --git a/internal/app/external/faker/user.go b/internal/app/external/faker/user.go index 53426c0..b8f3642 100644 --- a/internal/app/external/faker/user.go +++ b/internal/app/external/faker/user.go @@ -7,7 +7,7 @@ import ( "github.com/lithammer/shortuuid/v3" - "github.com/hadenlabs/terraform-module-template/internal/errors" + "github.com/hadenlabs/terraform-cloudflare/internal/errors" ) type FakeUser interface { diff --git a/internal/common/log/log.go b/internal/common/log/log.go index 4572b60..d1e54c9 100644 --- a/internal/common/log/log.go +++ b/internal/common/log/log.go @@ -1,9 +1,9 @@ package log import ( - "github.com/hadenlabs/terraform-module-template/config" - "github.com/hadenlabs/terraform-module-template/internal/common/log/provider" - "github.com/hadenlabs/terraform-module-template/internal/errors" + "github.com/hadenlabs/terraform-cloudflare/config" + "github.com/hadenlabs/terraform-cloudflare/internal/common/log/provider" + "github.com/hadenlabs/terraform-cloudflare/internal/errors" ) // New initialize a new Log. diff --git a/internal/common/log/log_test.go b/internal/common/log/log_test.go index cc74bc3..0c59c84 100644 --- a/internal/common/log/log_test.go +++ b/internal/common/log/log_test.go @@ -3,7 +3,7 @@ package log // import ( // "testing" -// "github.com/hadenlabs/terraform-module-template/internal/testutil/config" +// "github.com/hadenlabs/terraform-cloudflare/internal/testutil/config" // "github.com/stretchr/testify/assert" // ) diff --git a/internal/common/log/provider/zap.go b/internal/common/log/provider/zap.go index 42c2c0f..5739e96 100644 --- a/internal/common/log/provider/zap.go +++ b/internal/common/log/provider/zap.go @@ -3,7 +3,7 @@ package provider import ( "go.uber.org/zap" - "github.com/hadenlabs/terraform-module-template/config" + "github.com/hadenlabs/terraform-cloudflare/config" ) // Zap is a struct of Zap. diff --git a/internal/common/log/provider/zap_test.go b/internal/common/log/provider/zap_test.go index 90c0b30..0996f1b 100644 --- a/internal/common/log/provider/zap_test.go +++ b/internal/common/log/provider/zap_test.go @@ -3,7 +3,7 @@ package provider import ( "testing" - "github.com/hadenlabs/terraform-module-template/internal/testutil/config" + "github.com/hadenlabs/terraform-cloudflare/internal/testutil/config" ) func zapForTest() (*ZapLog, func()) { diff --git a/internal/testutil/config/config.go b/internal/testutil/config/config.go index 2b1b278..9253edc 100644 --- a/internal/testutil/config/config.go +++ b/internal/testutil/config/config.go @@ -3,8 +3,8 @@ package config import ( "github.com/joho/godotenv" - coreconfig "github.com/hadenlabs/terraform-module-template/config" - "github.com/hadenlabs/terraform-module-template/internal/errors" + coreconfig "github.com/hadenlabs/terraform-cloudflare/config" + "github.com/hadenlabs/terraform-cloudflare/internal/errors" ) func LoadEnvWithFilename(filename string) (*coreconfig.Config, error) { diff --git a/internal/testutil/config/config_test.go b/internal/testutil/config/config_test.go index dfd984b..eef7220 100644 --- a/internal/testutil/config/config_test.go +++ b/internal/testutil/config/config_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - coreconfig "github.com/hadenlabs/terraform-module-template/config" + coreconfig "github.com/hadenlabs/terraform-cloudflare/config" ) func TestConfigLoadEnvSuccess(t *testing.T) { diff --git a/mkdocs.yml b/mkdocs.yml index 5540c4c..f947e43 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ -site_name: terraform-module-template Documentation -theme: 'material' +site_name: terraform-cloudflare Documentation +theme: "material" markdown_extensions: - toc: permalink: True @@ -10,15 +10,15 @@ markdown_extensions: linenums: True extra: palette: - primary: '#087da1' - accent: '#00a889' + primary: "#087da1" + accent: "#00a889" font: - text: 'Source Sans Pro' + text: "Source Sans Pro" -repo_name: 'hadenlabs/terraform-module-template' -repo_url: 'https://github.com/hadenlabs/terraform-module-template' +repo_name: "hadenlabs/terraform-cloudflare" +repo_url: "https://github.com/hadenlabs/terraform-cloudflare" copyright: 'Copyright © 2021 hadenlabs' google_analytics: - - '' - - 'auto' + - "" + - "auto" diff --git a/package.json b/package.json index 1bfff05..99c8af8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@hadenlabs/terraform-module-template", + "name": "@hadenlabs/terraform-cloudflare", "version": "0.0.0", - "description": "terraform-module-template", + "description": "terraform-cloudflare", "author": "Luis Mayta ", "license": "LGPL-3.0", "engines": { @@ -33,7 +33,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/hadenlabs/terraform-module-template.git" + "url": "git+https://github.com/hadenlabs/terraform-cloudflare.git" }, "keywords": [ "hadenlabs", @@ -42,9 +42,9 @@ "tool" ], "bugs": { - "url": "https://github.com/hadenlabs/terraform-module-template/issues" + "url": "https://github.com/hadenlabs/terraform-cloudflare/issues" }, - "homepage": "https://github.com/hadenlabs/terraform-module-template#readme", + "homepage": "https://github.com/hadenlabs/terraform-cloudflare#readme", "dependencies": {}, "devDependencies": { "@types/rimraf": "^3.0.2", diff --git a/provision/diagrams/Taskfile.yml b/provision/diagrams/Taskfile.yml index 53c3c41..855a24a 100644 --- a/provision/diagrams/Taskfile.yml +++ b/provision/diagrams/Taskfile.yml @@ -1,6 +1,6 @@ # https://taskfile.dev -version: '3' +version: "3" tasks: build: diff --git a/provision/generators/README.yaml b/provision/generators/README.yaml index 826d52d..022556b 100644 --- a/provision/generators/README.yaml +++ b/provision/generators/README.yaml @@ -5,7 +5,7 @@ # # Name of this project -name: terraform-module-template +name: terraform-cloudflare # Tags of this project tags: @@ -22,25 +22,25 @@ email: # logo: docs/logo.png # License of this project -license: 'LGPL-3.0' +license: "LGPL-3.0" # Canonical GitHub repo -github_repo: hadenlabs/terraform-module-template +github_repo: hadenlabs/terraform-cloudflare # Badges to display badges: - name: Latest Release - image: https://img.shields.io/github/release/hadenlabs/terraform-module-template - url: https://github.com/hadenlabs/terraform-module-template/releases + image: https://img.shields.io/github/release/hadenlabs/terraform-cloudflare + url: https://github.com/hadenlabs/terraform-cloudflare/releases - name: Lint - image: https://img.shields.io/github/workflow/status/hadenlabs/terraform-module-template/lint-code - url: https://github.com/hadenlabs/terraform-module-template/actions?workflow=lint-code + image: https://img.shields.io/github/workflow/status/hadenlabs/terraform-cloudflare/lint-code + url: https://github.com/hadenlabs/terraform-cloudflare/actions?workflow=lint-code - name: CI - image: https://img.shields.io/github/workflow/status/hadenlabs/terraform-module-template/ci - url: https://github.com/hadenlabs/terraform-module-template/actions?workflow=ci + image: https://img.shields.io/github/workflow/status/hadenlabs/terraform-cloudflare/ci + url: https://github.com/hadenlabs/terraform-cloudflare/actions?workflow=ci - name: Test - image: https://img.shields.io/github/workflow/status/hadenlabs/terraform-module-template/test - url: https://github.com/hadenlabs/terraform-module-template/actions?workflow=test + image: https://img.shields.io/github/workflow/status/hadenlabs/terraform-cloudflare/test + url: https://github.com/hadenlabs/terraform-cloudflare/actions?workflow=test - name: pre-commit image: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white url: https://github.com/pre-commit/pre-commit @@ -66,19 +66,14 @@ requirements: |- # Short description of this project description: |- - terraform-module-template for project + terraform-cloudflare for project - ### Replace name project to New Project - - ```bash - agr 'terraform-module-template' 'new-project' - ``` usages: - docs/usage.md examples: - - 'docs/examples/common.md' + - "docs/examples/common.md" include: - - 'docs/include/targets.md' - - 'docs/include/terraform.md' + - "docs/include/targets.md" + - "docs/include/terraform.md" diff --git a/provision/generators/plop/generators/index.ts b/provision/generators/plop/generators/index.ts index 7f5b2d7..becd7f5 100644 --- a/provision/generators/plop/generators/index.ts +++ b/provision/generators/plop/generators/index.ts @@ -1,2 +1,2 @@ -import { testGenerator } from './test' +import { testGenerator } from "./test" export { testGenerator } diff --git a/provision/generators/plop/generators/test.ts b/provision/generators/plop/generators/test.ts index e334762..a874c48 100644 --- a/provision/generators/plop/generators/test.ts +++ b/provision/generators/plop/generators/test.ts @@ -1,83 +1,83 @@ -import { Actions, PlopGeneratorConfig } from 'node-plop' -import slugify from 'slugify' -import * as path from 'path' -import { baseGeneratorPath, baseTemplatesPath, pathExists, pathMake } from '../utils' +import { Actions, PlopGeneratorConfig } from "node-plop" +import slugify from "slugify" +import * as path from "path" +import { baseGeneratorPath, baseTemplatesPath, pathExists, pathMake } from "../utils" export enum TestPrompNames { - 'testName' = 'testName' + "testName" = "testName" } type Answers = { [P in TestPrompNames]: string } -const testPath = path.join(baseGeneratorPath, 'test') +const testPath = path.join(baseGeneratorPath, "test") export const testGenerator: PlopGeneratorConfig = { - description: 'add an path to test', + description: "add an path to test", prompts: [ { - type: 'input', + type: "input", name: TestPrompNames.testName, - message: 'What should it be test?', - default: 'basic' + message: "What should it be test?", + default: "basic" } ], actions: (data) => { const answers = data as Answers - const containerPath = `${testPath}/replace_name-${slugify(answers.testName, '-')}` + const containerPath = `${testPath}/replace_name-${slugify(answers.testName, "-")}` const containerDocsPath = `${containerPath}/docs` if (!pathExists(containerPath)) { pathMake(containerPath) pathMake(containerDocsPath) - pathMake(path.join(containerDocsPath, 'include')) + pathMake(path.join(containerDocsPath, "include")) } const actions: Actions = [] actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test.add.hbs`, - path: `${testPath}/replace_name_${slugify(answers.testName, '_')}_test.go`, + path: `${testPath}/replace_name_${slugify(answers.testName, "_")}_test.go`, abortOnFail: true }) actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test/main.add.hbs`, path: `${containerPath}/main.tf`, abortOnFail: false }) actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test/data.add.hbs`, path: `${containerPath}/data.tf`, abortOnFail: false }) actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test/outputs.add.hbs`, path: `${containerPath}/outputs.tf`, abortOnFail: true }) actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test/variables.add.hbs`, path: `${containerPath}/variables.tf`, abortOnFail: true }) actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test/versions.add.hbs`, path: `${containerPath}/versions.tf`, abortOnFail: true }) actions.push({ - type: 'add', + type: "add", templateFile: `${baseTemplatesPath}/test/docs/include/terraform.md`, path: `${containerDocsPath}/include/terraform.md`, abortOnFail: true diff --git a/provision/generators/plop/index.ts b/provision/generators/plop/index.ts index 45b0674..1c25839 100644 --- a/provision/generators/plop/index.ts +++ b/provision/generators/plop/index.ts @@ -1,6 +1,6 @@ -import { NodePlopAPI } from 'node-plop' -import { testGenerator } from './generators' +import { NodePlopAPI } from "node-plop" +import { testGenerator } from "./generators" export default function plop(plop: NodePlopAPI): void { - plop.setGenerator('test', testGenerator) + plop.setGenerator("test", testGenerator) } diff --git a/provision/generators/plop/templates/test.add.hbs b/provision/generators/plop/templates/test.add.hbs index 2b05d5a..366e620 100644 --- a/provision/generators/plop/templates/test.add.hbs +++ b/provision/generators/plop/templates/test.add.hbs @@ -5,9 +5,9 @@ import ( "github.com/gruntwork-io/terratest/modules/terraform" - "github.com/hadenlabs/terraform-module-template/config" + "github.com/hadenlabs/terraform-cloudflare/config" "github.com/stretchr/testify/assert" - "github.com/hadenlabs/terraform-module-template/internal/common/log" + "github.com/hadenlabs/terraform-cloudflare/internal/common/log" ) func Test{{pascalCase testName}}Success(t *testing.T) { @@ -15,7 +15,7 @@ func Test{{pascalCase testName}}Success(t *testing.T) { conf := config.Must() logger := log.Factory(*conf) logger.Debugf( - "values for test terraform-module-template is", + "values for test terraform-cloudflare is", ) terraformOptions := &terraform.Options{ diff --git a/provision/generators/plop/utils/helpers.ts b/provision/generators/plop/utils/helpers.ts index 7f1558b..310909d 100644 --- a/provision/generators/plop/utils/helpers.ts +++ b/provision/generators/plop/utils/helpers.ts @@ -1,15 +1,15 @@ -import * as path from 'path' -import fs from 'fs' +import * as path from "path" +import fs from "fs" -export const baseGeneratorPath = path.join(__dirname, '../../../../') -export const baseTemplatesPath = path.join(__dirname, '../templates') +export const baseGeneratorPath = path.join(__dirname, "../../../../") +export const baseTemplatesPath = path.join(__dirname, "../templates") export const cleanString = (text: string): string => { - return text.replace(/[.-_]+/g, ' ').toLowerCase() + return text.replace(/[.-_]+/g, " ").toLowerCase() } export const hyphenate = (text: string): string => { - return text.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase() + return text.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase() } export function pathExists(path: string): boolean { diff --git a/provision/generators/plop/utils/index.ts b/provision/generators/plop/utils/index.ts index 368cef9..ce74c6d 100644 --- a/provision/generators/plop/utils/index.ts +++ b/provision/generators/plop/utils/index.ts @@ -5,5 +5,5 @@ import { pathMake, baseTemplatesPath, cleanString -} from './helpers' +} from "./helpers" export { hyphenate, baseGeneratorPath, pathExists, pathMake, baseTemplatesPath, cleanString } diff --git a/provision/task/changelog.yml b/provision/task/changelog.yml index 0979f9a..e6e2f64 100644 --- a/provision/task/changelog.yml +++ b/provision/task/changelog.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" env: TMP_CHANGELOG_FILENAME: TMP_CHANGELOG.md @@ -16,14 +16,14 @@ tasks: run: once preconditions: - sh: command -v git-chglog - msg: 'Please install git-chglog' + msg: "Please install git-chglog" check:go: desc: Exist go run: once preconditions: - sh: command -v go - msg: 'Please install go' + msg: "Please install go" install: desc: install dependences git-chglog diff --git a/provision/task/confluence.yml b/provision/task/confluence.yml index ba9af71..d26b749 100644 --- a/provision/task/confluence.yml +++ b/provision/task/confluence.yml @@ -1,6 +1,6 @@ # https://taskfile.dev -version: '3' +version: "3" tasks: default: @@ -22,18 +22,18 @@ tasks: run: once preconditions: - sh: command -v docker - msg: 'Please Install docker' + msg: "Please Install docker" check:vars: desc: Exist vars for mark run: once preconditions: - sh: test -v CONFLUENCE_BASE_URL - msg: 'Please add var environment CONFLUENCE_BASE_URL' + msg: "Please add var environment CONFLUENCE_BASE_URL" - sh: test -v CONFLUENCE_ACCESS_TOKEN - msg: 'Please add var environment CONFLUENCE_ACCESS_TOKEN' + msg: "Please add var environment CONFLUENCE_ACCESS_TOKEN" - sh: test -v CONFLUENCE_USER - msg: 'Please add var environment CONFLUENCE_USER' + msg: "Please add var environment CONFLUENCE_USER" make:credentials: desc: run sync mark. diff --git a/provision/task/docker.yml b/provision/task/docker.yml index 288732d..3f01e88 100644 --- a/provision/task/docker.yml +++ b/provision/task/docker.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -12,18 +12,18 @@ tasks: run: once preconditions: - sh: command -v docker - msg: 'Please Install docker' + msg: "Please Install docker" check:vars: desc: Exist vars for docker run: once preconditions: - sh: test -v CI_REGISTRY_USER - msg: 'Please add var environment CI_REGISTRY_USER' + msg: "Please add var environment CI_REGISTRY_USER" - sh: test -v CI_REGISTRY_PASSWORD - msg: 'Please add var environment CI_REGISTRY_PASSWORD' + msg: "Please add var environment CI_REGISTRY_PASSWORD" - sh: test -v CI_REGISTRY - msg: 'Please add var environment CI_REGISTRY' + msg: "Please add var environment CI_REGISTRY" login: silent: true @@ -42,7 +42,8 @@ tasks: cmds: - >- docker build - --platform={{.DOCKER_PLATFORMS}} + --no-cache + --platform={{.DOCKER_PLATFORM}} --file Dockerfile --tag {{.CI_REGISTRY}}/{{.GROUP_NAME}}/{{.PROJECT_NAME}}:{{.APP_TAG}} . --build-arg VERSION={{.APP_TAG}} @@ -56,7 +57,7 @@ tasks: - >- docker buildx build --no-cache - --platform={{.DOCKER_PLATFORMS}} + --platform={{.DOCKER_PLATFORM}} --file Dockerfile --tag {{.CI_REGISTRY}}/{{.GROUP_NAME}}/{{.PROJECT_NAME}}:{{.APP_TAG}} . --build-arg VERSION={{.APP_TAG}} diff --git a/provision/task/docs.yml b/provision/task/docs.yml index 45cc90b..81fa4da 100644 --- a/provision/task/docs.yml +++ b/provision/task/docs.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -6,7 +6,7 @@ tasks: run: once deps: - task: check:python - - task: check:pipenv + - task: check:poetry - task: check:mkdocs - task: check:grip @@ -15,34 +15,34 @@ tasks: run: once preconditions: - sh: command -v python - msg: 'Please Install python' + msg: "Please Install python" - check:pipenv: - desc: Exist Pipenv + check:poetry: + desc: Exist Poetry run: once preconditions: - - sh: command -v pipenv - msg: 'Please Install pipenv' + - sh: command -v poetry + msg: "Please Install poetry" check:mkdocs: desc: Exist mkdocs run: once preconditions: - - sh: test "pipenv run command -v mkdocs" - msg: 'Please Install mkdocs' + - sh: test "poetry run command -v mkdocs" + msg: "Please Install mkdocs" check:grip: desc: Exist grip run: once preconditions: - - sh: test "pipenv run command -v grip" - msg: 'Please Install grip' + - sh: test "poetry run command -v grip" + msg: "Please Install grip" show: desc: Show grip readme. run: once cmds: - - pipenv run grip + - poetry run grip deps: - task: check:grip @@ -50,7 +50,7 @@ tasks: desc: Build documentation with mkdocs. run: once cmds: - - pipenv run mkdocs build + - poetry run mkdocs build deps: - task: check:mkdocs @@ -58,6 +58,6 @@ tasks: desc: Server make documentation. run: once cmds: - - pipenv run mkdocs serve --dev-addr '127.0.0.1:8001' + - poetry run mkdocs serve --dev-addr '127.0.0.1:8001' deps: - task: check:mkdocs diff --git a/provision/task/git.yml b/provision/task/git.yml index 43b4985..e8f3ecd 100644 --- a/provision/task/git.yml +++ b/provision/task/git.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -12,7 +12,7 @@ tasks: run: once preconditions: - sh: command -v git - msg: 'Please Install git' + msg: "Please Install git" setup: desc: Setup git. diff --git a/provision/task/gitflow.yml b/provision/task/gitflow.yml index a25f621..a11b8c1 100644 --- a/provision/task/gitflow.yml +++ b/provision/task/gitflow.yml @@ -1,8 +1,8 @@ -version: '3' +version: "3" tasks: check: - desc: 'Exist git-flow and dependences' + desc: "Exist git-flow and dependences" run: once deps: - task: check:git @@ -13,23 +13,23 @@ tasks: run: once preconditions: - sh: command -v git - msg: 'Please Install git' + msg: "Please Install git" check:gitflow: - desc: 'Exist git-flow' + desc: "Exist git-flow" run: once preconditions: - sh: command -v git-flow - msg: 'Please Install git-flow' + msg: "Please Install git-flow" setup: - desc: 'Setup all gitflow actions.' + desc: "Setup all gitflow actions." run: once cmds: - task: prefix install: - desc: 'Install gitflow configuration.' + desc: "Install gitflow configuration." run: once cmds: - git-flow init -d @@ -37,7 +37,7 @@ tasks: - task: check prefix: - desc: 'Generate gitflow prefix of files.' + desc: "Generate gitflow prefix of files." run: once cmds: - git config gitflow.prefix.feature {{.GITFLOW_PREFIX_FEATURE}} diff --git a/provision/task/go.yml b/provision/task/go.yml index 1ad1198..d0f4bee 100644 --- a/provision/task/go.yml +++ b/provision/task/go.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" env: GO_FILES: @@ -19,28 +19,28 @@ tasks: run: once preconditions: - sh: command -v go - msg: 'Please Install Go' + msg: "Please Install Go" check:gofmt: desc: Exist gofmt run: once preconditions: - sh: command -v gofmt - msg: 'Please Install gofmt' + msg: "Please Install gofmt" check:golangcilint: desc: Exist golangci-lint run: once preconditions: - sh: command -v golangci-lint - msg: 'Please Install golangci-lint' + msg: "Please Install golangci-lint" check:goreleaser: desc: Exist goreleaser run: once preconditions: - sh: command -v goreleaser - msg: 'Please Install goreleaser' + msg: "Please Install goreleaser" setup: desc: Setup go dependences. @@ -53,6 +53,12 @@ tasks: deps: - task: check:go + prettier: + desc: format files go. + run: once + cmds: + - task: fmt + fmt: desc: format files go. run: once diff --git a/provision/task/mark.yml b/provision/task/mark.yml index 3e101d8..09c24a3 100644 --- a/provision/task/mark.yml +++ b/provision/task/mark.yml @@ -1,6 +1,6 @@ # https://taskfile.dev -version: '3' +version: "3" vars: FILES_CONFLUENCE: @@ -33,18 +33,18 @@ tasks: run: once preconditions: - sh: command -v docker - msg: 'Please Install docker' + msg: "Please Install docker" check:vars: desc: Exist vars for mark run: once preconditions: - sh: test -v CONFLUENCE_BASE_URL - msg: 'Please add var environment CONFLUENCE_BASE_URL' + msg: "Please add var environment CONFLUENCE_BASE_URL" - sh: test -v CONFLUENCE_ACCESS_TOKEN - msg: 'Please add var environment CONFLUENCE_ACCESS_TOKEN' + msg: "Please add var environment CONFLUENCE_ACCESS_TOKEN" - sh: test -v CONFLUENCE_USER - msg: 'Please add var environment CONFLUENCE_USER' + msg: "Please add var environment CONFLUENCE_USER" mark: desc: run mark. diff --git a/provision/task/plantuml.yml b/provision/task/plantuml.yml index 0d4e187..e5f409e 100644 --- a/provision/task/plantuml.yml +++ b/provision/task/plantuml.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -12,7 +12,7 @@ tasks: run: once preconditions: - sh: command -v docker - msg: 'Please Install docker' + msg: "Please Install docker" make: desc: generate plantuml. diff --git a/provision/task/prettier.yml b/provision/task/prettier.yml index 0a81266..296e831 100644 --- a/provision/task/prettier.yml +++ b/provision/task/prettier.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -12,7 +12,7 @@ tasks: run: once preconditions: - sh: command -v prettier - msg: 'Please Install prettier' + msg: "Please Install prettier" all: run: once @@ -20,7 +20,7 @@ tasks: cmds: - task: execute vars: - FILES_PRETTIER: '**/*.{js?(on),scss,less,ts?(x),md,y?(a)ml,gql,graphql?(s),mjml}' + FILES_PRETTIER: "**/*.{js?(on),scss,less,ts?(x),md,y?(a)ml,gql,graphql?(s),mjml}" less: run: once @@ -28,7 +28,7 @@ tasks: cmds: - task: execute vars: - FILES_PRETTIER: '**/*.less' + FILES_PRETTIER: "**/*.less" code: run: once @@ -36,7 +36,7 @@ tasks: cmds: - task: execute vars: - FILES_PRETTIER: '**/*.{js?(on),ts?(x),md,y?(a)ml,gql,graphql?(s),mjml}' + FILES_PRETTIER: "**/*.{js?(on),ts?(x),md,y?(a)ml,gql,graphql?(s),mjml}" sass: run: once @@ -44,7 +44,7 @@ tasks: cmds: - task: execute vars: - FILES_PRETTIER: '**/*.scss' + FILES_PRETTIER: "**/*.scss" execute: run: once diff --git a/provision/task/python.yml b/provision/task/python.yml index 49c3397..e9d8f26 100644 --- a/provision/task/python.yml +++ b/provision/task/python.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -6,7 +6,7 @@ tasks: run: once deps: - task: check:python - - task: check:pipenv + - task: check:poetry - task: check:precommit check:python: @@ -14,61 +14,61 @@ tasks: run: once preconditions: - sh: command -v python - msg: 'Please Install python' + msg: "Please Install python" - check:pipenv: - desc: Exist Pipenv + check:poetry: + desc: Exist Poetry run: once preconditions: - - sh: command -v pipenv - msg: 'Please Install pipenv' + - sh: command -v poetry + msg: "Please Install poetry" check:precommit: desc: Exist pre-commit run: once preconditions: - - sh: test "pipenv run command -v pre-commit" - msg: 'Please Install pre-commit' + - sh: test "poetry run command -v pre-commit" + msg: "Please Install pre-commit" setup: desc: Setup python dependences. run: once cmds: - - pipenv install --dev --skip-lock --python="$(which python)" + - poetry install --with dev deps: - task: check:python - - task: check:pipenv + - task: check:poetry fmt: desc: format black python. run: once cmds: - cmd: >- - pipenv run black ./ {{.CLI_ARGS}} + poetry run black ./ {{.CLI_ARGS}} test: desc: run pytest. run: once cmds: - cmd: >- - pipenv run pytest + poetry run pytest environment: desc: Generate environment python. run: once cmds: - - pipenv --venv || pipenv install --skip-lock + - poetry env info || poetry install deps: - task: check:python - - task: check:pipenv + - task: check:poetry precommit: desc: Install pre-commit. run: once cmds: - - pipenv run pre-commit install - - pipenv run pre-commit install -t pre-push - - pipenv run pre-commit install -t commit-msg - - pipenv run pre-commit install -t prepare-commit-msg + - poetry run pre-commit install + - poetry run pre-commit install -t pre-push + - poetry run pre-commit install -t commit-msg + - poetry run pre-commit install -t prepare-commit-msg deps: - task: check diff --git a/provision/task/sonar.yml b/provision/task/sonar.yml index ab8ef64..5039467 100644 --- a/provision/task/sonar.yml +++ b/provision/task/sonar.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -13,16 +13,16 @@ tasks: run: once preconditions: - sh: command -v docker - msg: 'Please Install docker' + msg: "Please Install docker" check:vars: desc: Exist vars for sonarqube run: once preconditions: - sh: test -v SONAR_URL - msg: 'Please add var environment SONAR_URL' + msg: "Please add var environment SONAR_URL" - sh: test -v SONAR_TOKEN - msg: 'Please add var environment SONAR_TOKEN' + msg: "Please add var environment SONAR_TOKEN" show: desc: show vars sonarqube. diff --git a/provision/task/sops.yml b/provision/task/sops.yml new file mode 100644 index 0000000..a0ffe15 --- /dev/null +++ b/provision/task/sops.yml @@ -0,0 +1,56 @@ +version: "3" + +tasks: + check: + desc: Exist sops and dependences + run: once + deps: + - task: check:sops + - task: check:age + - task: check:vars + + check:sops: + desc: Exist sops + run: once + preconditions: + - sh: command -v sops + msg: "Please Install sops" + + check:age: + desc: Exist age + run: once + preconditions: + - sh: command -v age + msg: "Please Install age" + + check:vars: + desc: Exist vars for sops + run: once + preconditions: + - sh: test -v SOPS_AGE_KEY_FILE + msg: "Please add var environment SOPS_AGE_KEY_FILE" + - sh: test -v KEYBASE_PROJECT_PATH + msg: "Please add var environment KEYBASE_PROJECT_PATH" + + make: + desc: Make sops gen key. + run: once + deps: + - task: check + - task: environment + cmds: + - >- + age-keygen -o {{.SOPS_AGE_KEY_FILE}} + status: + - test -f {{.SOPS_AGE_KEY_FILE}} + + environment: + desc: setup environment sops. + run: once + deps: + - task: check:sops + cmds: + - >- + mkdir -p {{.KEYBASE_PROJECT_PATH}}/age + status: + - test -d {{.KEYBASE_PROJECT_PATH}}/age diff --git a/provision/task/ssh.yml b/provision/task/ssh.yml index 219f41f..0e628d3 100644 --- a/provision/task/ssh.yml +++ b/provision/task/ssh.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -12,7 +12,7 @@ tasks: run: once preconditions: - sh: command -v ssh-keygen - msg: 'Please Install ssh-keygen' + msg: "Please Install ssh-keygen" make:pem:dev: desc: Make pem for stage dev @@ -22,6 +22,14 @@ tasks: vars: STAGE: dev + make:pem:staging: + desc: Make pem for stage staging + run: once + cmds: + - task: make + vars: + STAGE: staging + make:pem:testing: desc: Make pem for stage testing run: once @@ -43,3 +51,46 @@ tasks: openssl rsa -in {{.PROJECT_NAME}}-{{.STAGE}} -outform pem > {{.PROJECT_NAME}}-{{.STAGE}}.pem - >- chmod 0600 {{.PROJECT_NAME}}-{{.STAGE}}.pem + status: + - test -f {{.PROJECT_NAME}}-{{.STAGE}}.pem + + export: + desc: export keys. + run: once + deps: + - task: check + cmds: + - >- + mkdir -p {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ + - >- + mv {{.PROJECT_NAME}}-{{.STAGE}} {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ + mv {{.PROJECT_NAME}}-{{.STAGE}}.pub {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ + mv {{.PROJECT_NAME}}-{{.STAGE}}.pem {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ + status: + - test -f {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/{{.PROJECT_NAME}}-{{.STAGE}} + - test -f {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/{{.PROJECT_NAME}}-{{.STAGE}}.pub + - test -f {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/{{.PROJECT_NAME}}-{{.STAGE}}.pem + + export:pem:dev: + desc: Export pem for stage dev + run: once + cmds: + - task: export + vars: + STAGE: dev + + export:pem:staging: + desc: Export pem for stage staging + run: once + cmds: + - task: export + vars: + STAGE: staging + + export:pem:prod: + desc: Export pem for stage prod + run: once + cmds: + - task: export + vars: + STAGE: prod diff --git a/provision/task/terraform.yml b/provision/task/terraform.yml index 2615afb..13c3a30 100644 --- a/provision/task/terraform.yml +++ b/provision/task/terraform.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -12,16 +12,82 @@ tasks: run: once preconditions: - sh: command -v terraform - msg: 'Please Install terraform' + msg: "Please Install terraform" + + check:tfenv: + desc: Exist tfenv + run: once + preconditions: + - sh: command -v tfenv + msg: "Please Install tfenv" + + check:vars: + desc: Exist Terraform + run: once + preconditions: + - sh: test -v AWS_PROFILE_NAME + msg: "Please add var environment AWS_PROFILE_NAME" + - sh: test {{.AWS_PROFILE_NAME}} == {{.ORGANIZATION}} + msg: "Please load var environment AWS of {{.ORGANIZATION}}" + + environment: + desc: Generate environment terraform. + run: once + cmds: + - tfenv use {{ .TERRAFORM_VERSION }} || tfenv install {{ .TERRAFORM_VERSION }} && tfenv use {{ .TERRAFORM_VERSION }} + deps: + - task: check:tfenv command: desc: generate docs using docs - run: once deps: - task: check cmds: - >- - terraform-docs ./ --config=.ci/config/.terraform-docs.yml + terraform-docs markdown provision/terraform/{{.REGION}}/{{.STAGE}} --config=.ci/config/.terraform-docs.yml + + docs:core: + desc: generate docs using docs for core + run: once + deps: + - task: check + cmds: + - task: command + vars: + STAGE: core + + docs:prod: + desc: generate docs using terraform-docs + run: once + deps: + - task: check + cmds: + - task: command + vars: + STAGE: prod + REGION: us-east-1 + + docs:staging: + desc: generate docs using terraform-docs + run: once + deps: + - task: check + cmds: + - task: command + vars: + STAGE: staging + REGION: us-east-1 + + docs:dev: + desc: generate docs using terraform-docs + run: once + deps: + - task: check + cmds: + - task: command + vars: + STAGE: dev + REGION: us-east-1 docs:all: desc: generate docs using docs all @@ -29,4 +95,7 @@ tasks: deps: - task: check cmds: - - task: command + - task: docs:core + - task: docs:prod + - task: docs:staging + - task: docs:dev diff --git a/provision/task/terragrunt.yml b/provision/task/terragrunt.yml new file mode 100644 index 0000000..94b9ceb --- /dev/null +++ b/provision/task/terragrunt.yml @@ -0,0 +1,174 @@ +version: "3" + +tasks: + check: + desc: Exist terragrunt and dependences + run: once + deps: + - task: check:terragrunt + - task: check:terraform + + check:terragrunt: + desc: Exist Terragrunt + run: once + preconditions: + - sh: command -v terragrunt + msg: "Please Install terragrunt" + + check:terraform: + desc: Exist Terraform + run: once + preconditions: + - sh: command -v terraform + msg: "Please Install terraform" + + check:vars: + desc: Exist Terraform + run: once + preconditions: + - sh: test -v AWS_PROFILE_NAME + msg: "Please add var environment AWS_PROFILE_NAME" + - sh: test {{.AWS_PROFILE_NAME}} == {{.ORGANIZATION}} + msg: "Please load var environment AWS of {{.ORGANIZATION}}" + + setup: + desc: install setup + run: once + deps: + - task: check + cmds: + - >- + tfenv install {{.TERRAFORM_VERSION}} + - >- + tfenv use {{.TERRAFORM_VERSION}} + + environment: + desc: use version terraform + run: once + deps: + - task: check + cmds: + - >- + tfenv use {{.TERRAFORM_VERSION}} + + import: + desc: import command terragrunt + run: once + deps: + - task: check + cmds: + - cmd: terragrunt import {{.COMMAND}} --terragrunt-working-dir {{.TERRAFORM_DIR}}/{{.REGION}}/{{.STAGE}} --terragrunt-source-update + vars: + REGION: us-east-1 + + state: + desc: state command terragrunt + run: once + deps: + - task: check + cmds: + - cmd: terragrunt state {{.COMMAND}} --terragrunt-working-dir {{.TERRAFORM_DIR}}/{{.REGION}}/{{.STAGE}} --terragrunt-source-update + vars: + REGION: us-east-1 + + module: + desc: module command terragrunt + run: once + deps: + - task: check + cmds: + - cmd: terragrunt {{.MODULE_COMMAND}} --terragrunt-working-dir {{.TERRAFORM_DIR}}/{{.REGION}}/{{.STAGE}} --terragrunt-source-update -target=module.{{.MODULE}} + vars: + REGION: us-east-1 + + module:destroy: + desc: module destroy command terragrunt + run: once + deps: + - task: check + cmds: + - cmd: terragrunt {{.MODULE_COMMAND}} --terragrunt-working-dir {{.TERRAFORM_DIR}}/{{.REGION}}/{{.STAGE}} --terragrunt-source-update -target=module.{{.MODULE}} + vars: + REGION: us-east-1 + MODULE_COMMAND: destroy + + module:apply: + desc: module apply command terragrunt + run: once + deps: + - task: check + cmds: + - cmd: terragrunt {{.MODULE_COMMAND}} --terragrunt-working-dir {{.TERRAFORM_DIR}}/{{.REGION}}/{{.STAGE}} --terragrunt-source-update -target=module.{{.MODULE}} + vars: + REGION: us-east-1 + MODULE_COMMAND: apply + + command: + desc: make command terragrunt + run: once + deps: + - task: check + cmds: + - cmd: terragrunt {{.TERRAGRUNT_COMMAND}} --terragrunt-working-dir {{.TERRAFORM_DIR}}/{{.REGION}}/{{.STAGE}} --terragrunt-source-update + vars: + REGION: us-east-1 + + init: + desc: make terragrunt init + run: once + deps: + - task: check + cmds: + - task: command + vars: + TERRAGRUNT_COMMAND: init + + plan: + desc: make terragrunt plan + run: once + deps: + - task: check + cmds: + - task: command + vars: + TERRAGRUNT_COMMAND: plan + + apply: + desc: make terragrunt apply + run: once + deps: + - task: check + cmds: + - task: command + vars: + TERRAGRUNT_COMMAND: apply + + refresh: + desc: make terragrunt refresh + run: once + deps: + - task: check + cmds: + - task: command + vars: + TERRAGRUNT_COMMAND: refresh + + destroy: + desc: make terragrunt destroy + run: once + deps: + - task: check + cmds: + - task: command + vars: + TERRAGRUNT_COMMAND: destroy + + output: + desc: make terragrunt output + run: once + deps: + - task: command + cmds: + - task: make + vars: + TERRAGRUNT_COMMAND: output diff --git a/provision/task/version.yml b/provision/task/version.yml index be349f3..b9d58f9 100644 --- a/provision/task/version.yml +++ b/provision/task/version.yml @@ -1,26 +1,26 @@ -version: '3' +version: "3" tasks: default: - desc: 'Show current release version' + desc: "Show current release version" cmds: - - echo Release version {{.APP_TAG}} + - echo "Release version {{.APP_TAG}}" silent: true major: - desc: 'Increase major version' + desc: "Increase major version" run: once cmds: - - pipenv run bumpversion major + - poetry version major minor: - desc: 'Increase minor version' + desc: "Increase minor version" run: once cmds: - - pipenv run bumpversion minor + - poetry version minor patch: - desc: 'Increase patch version' + desc: "Increase patch version" run: once cmds: - - pipenv run bumpversion patch + - poetry version patch diff --git a/provision/task/yarn.yml b/provision/task/yarn.yml index dbee5ca..d48199e 100644 --- a/provision/task/yarn.yml +++ b/provision/task/yarn.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" tasks: check: @@ -13,14 +13,14 @@ tasks: run: once preconditions: - sh: command -v yarn - msg: 'Please Install yarn' + msg: "Please Install yarn" check:nvm: desc: Exist Nvm run: once preconditions: - sh: test "command -v nvm" - msg: 'Please Install nvm' + msg: "Please Install nvm" setup: desc: Setup yarn dependences. @@ -30,6 +30,14 @@ tasks: deps: - task: check:yarn + update: + desc: Update yarn. + run: once + cmds: + - yarn ncu:patch + deps: + - task: check:yarn + environment: desc: Setup environment nvm version node. run: once diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c532d10 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,60 @@ +[tool.poetry] +name = "terraform-cloudflare" +version = "0.0.0" +description = "terraform cloudflare" +authors = ["Luis Mayta "] +license = "LGPL-3.0" +readme = "README.md" +repository = "https://github.com/hadenlabs/terraform-cloudflare" + +[tool.poetry.dependencies] +python = "^3.8,<3.12" +boto3 = "^1.26.130" + +[tool.poetry.group.dev.dependencies] +requests = "^2.28.2" +bridgecrew = "*" +doc8 = "*" +grip = "*" +isort = "*" +mkdocs = "*" +mkdocs-material = "*" +mypy = "*" +parso = "*" +pre-commit = "*" +pycodestyle = "*" +pydocstyle = "*" +pygments = "*" +pylint = "*" +pymdown-extensions = "*" +pytest = ">=6.2.4" +black = "*" +bumpversion = "*" + +[tool.poetry.extras] +docs = ["mkdocs", "mkdocs-material"] + +[tool.poetry_bumpversion.file."sonar-project.properties"] +search = 'sonar.projectVersion={current_version}' +replace = 'sonar.projectVersion={new_version}' + +[tool.poetry_bumpversion.file."package.json"] +search = '{current_version}' +replace = '{new_version}' + +[tool.poetry_bumpversion.file."docs/usage.md"] +search = '{current_version}' +replace = '{new_version}' + +[tool.poetry_bumpversion.file."internal/version/version.go"] +search = '{current_version}' +replace = '{new_version}' + + +[tool.poetry_bumpversion.file."docs/examples/common.md"] +search = '{current_version}' +replace = '{new_version}' + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/sonar-project.properties b/sonar-project.properties index ce6b454..fa3422f 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,6 @@ sonar.organization=hadenlabs -sonar.projectKey=hadenlabs:terraform-module-template -sonar.projectName=terraform-module-template +sonar.projectKey=hadenlabs:terraform-cloudflare +sonar.projectName=terraform-cloudflare sonar.projectVersion=0.0.0 sonar.projectBaseDir=./ sonar.sources=./