From 192dcd88e8160473513c00710da375f3ac961f5b Mon Sep 17 00:00:00 2001 From: sheldonhull Date: Thu, 1 Sep 2022 18:06:41 -0500 Subject: [PATCH] chore: sync latest github workflows, settings, scans, and dev tooling (#10) Aligning repo with all default configuration: - add tfplugindocs integration to generate readme on template - pre-commit - devcontainer (optional to use) - default linting initialized in vscode - github actions from standard actions - renovate/mend integration - mage tasks --- .envrc | 8 + .gitattributes | 87 ++++++++++- .github/CODEOWNERS | 2 + .github/auto-assign.yml | 14 ++ .github/workflows/assign.yml | 25 ++++ .github/workflows/conventional-pr.yml | 44 ++++++ .github/workflows/lint.yml | 23 +++ .github/workflows/stale.yaml | 28 ++++ .github/workflows/test.yml | 42 ++++++ .gitleaks.toml | 203 ++++++++++++++++++++++++++ .goreleaser.yml | 73 ++++----- .markdownlint-cli2.yaml | 59 ++++++++ .pre-commit-config.yaml | 114 +++++++++++++++ .whitesource | 25 ++++ .yamllint.yaml | 20 +++ docs/index.md | 92 ++++++++++-- example.tf => examples/example.tf | 0 go.mod | 37 ++++- go.sum | 110 +++++++++++++- magefiles/constants/constants.mage.go | 14 ++ magefiles/dev-cli-tools.go | 22 +++ magefiles/goreleaser.mage.go | 89 +++++++++++ magefiles/jobs.mage.go | 8 + magefiles/mage.go | 14 ++ magefiles/magefile.go | 88 +++++++++++ magefiles/tools.go | 12 ++ renovate.json | 6 + templates/index.md.tmpl | 44 ++++++ 28 files changed, 1242 insertions(+), 61 deletions(-) create mode 100644 .envrc create mode 100644 .github/CODEOWNERS create mode 100644 .github/auto-assign.yml create mode 100644 .github/workflows/assign.yml create mode 100644 .github/workflows/conventional-pr.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/stale.yaml create mode 100644 .github/workflows/test.yml create mode 100644 .gitleaks.toml create mode 100644 .markdownlint-cli2.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 .whitesource create mode 100644 .yamllint.yaml rename example.tf => examples/example.tf (100%) create mode 100644 magefiles/constants/constants.mage.go create mode 100644 magefiles/dev-cli-tools.go create mode 100644 magefiles/goreleaser.mage.go create mode 100644 magefiles/jobs.mage.go create mode 100644 magefiles/mage.go create mode 100644 magefiles/magefile.go create mode 100644 magefiles/tools.go create mode 100644 renovate.json create mode 100644 templates/index.md.tmpl diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..e2f8c618 --- /dev/null +++ b/.envrc @@ -0,0 +1,8 @@ +export DIRENV_WARN_TIMEOUT='10s' +export DIRENV_LOG_FORMAT="" + +source_env "$HOME" +source_env_if_exists ./env/.envrc +export PATH="${GOPATH}/bin:${PATH}" + +export MAGEFILE_ENABLE_COLOR=1 diff --git a/.gitattributes b/.gitattributes index 07764a78..592c319d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,86 @@ -* text eol=lf \ No newline at end of file +# Prevents issues when working with multiple platforms as developers. +# For more useful information see this great article: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/ +# Common settings that generally should always be used with your language specific settings +# CHECK FOR ISSUES: git ls-files --eol +# RESOLVE ISSUES: git add --renormalize . + +# Auto detect text files and perform LF normalization +# https://www.davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto eol=lf + +# +# The above will handle all files NOT found below +# + +# Documents +*.bibtex text diff=bibtex +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.md text diff=markdown +*.tex text diff=tex +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +*.sql text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as text by default. +*.svg text +# If you want to treat it as binary, +# use the following line instead. +# *.svg binary +*.eps binary + +# Scripts +*.bash text eol=lf +*.fish text eol=lf +*.sh text eol=lf +*.zsh text eol=lf +# These are explicitly windows files and should use crlf +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Serialisation +*.json text +*.toml text +*.xml text +*.yaml text +*.yml text + +# Archives +*.7z binary +*.gz binary +*.tar binary +*.tgz binary +*.zip binary + +# Text files where line endings should be preserved +*.patch -text + +# +# Exclude files from exporting +# + +.gitattributes export-ignore +.gitignore export-ignore +.gitkeep export-ignore diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..d4f9d02b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +.github @DelineaXPM/dsv-admins +* @DelineaXPM/dsv-contributors diff --git a/.github/auto-assign.yml b/.github/auto-assign.yml new file mode 100644 index 00000000..75a1cec8 --- /dev/null +++ b/.github/auto-assign.yml @@ -0,0 +1,14 @@ +--- +# Schema: https://github.com/kentaro-m/auto-assign-action +runOnDraft: true +addReviewers: true +addAssignees: author +numberOfReviewers: 0 +reviewers: +reviewGroups: +useReviewGroups: false +# filterLabels: +# exclude: +# - wontmerge +# - wip +# - incomplete pr diff --git a/.github/workflows/assign.yml b/.github/workflows/assign.yml new file mode 100644 index 00000000..1456ffb4 --- /dev/null +++ b/.github/workflows/assign.yml @@ -0,0 +1,25 @@ +--- +name: assign +on: + # pull_request: # For testing changes in branch + pull_request_target: + types: [opened, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + assign: + name: assign + runs-on: ubuntu-latest + timeout-minutes: 5 + + permissions: + pull-requests: write + contents: read # Because it needs to read the configuration file + steps: + - uses: kentaro-m/auto-assign-action@60730395fd3afb76c7407e16cd4b144fbbcf28a6 # renovate: tag=v1 + with: + configuration-path: .github/auto-assign.yml # Only needed if you use something other than .github/auto_assign.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/conventional-pr.yml b/.github/workflows/conventional-pr.yml new file mode 100644 index 00000000..16713c63 --- /dev/null +++ b/.github/workflows/conventional-pr.yml @@ -0,0 +1,44 @@ +--- +name: conventional-commit-pr-title +on: + pull_request_target: + # pull_request: + types: + - opened + - edited + - synchronize +jobs: + main: + name: conventional-commit-pr-title + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + pull-requests: read + steps: + - uses: amannn/action-semantic-pull-request@91682d013dea3ff257520b9b68c9cb93ced4fe9b # renovate: tag=v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + feat + fix + chore + refactor + test + docs + style + perf + ci + build + revert + requireScope: false + subjectPattern: ^(?![A-Z]).+$ + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + doesn't start with an uppercase character. + ignoreLabels: | + ignore-semantic-pull-request + headerPattern: '^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$' + headerPatternCorrespondence: type, scope, subject + wip: false # This requires elevated permissions, not using diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..fc3643af --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +--- +name: lint +on: + pull_request: + workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +permissions: + pull-requests: read + contents: read +jobs: + lint: + name: lint + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: checkout + uses: actions/checkout@v3 + # Automatically caches for performance as well + # https://github.com/reviewdog/action-golangci-lint + - name: golangci-lint + uses: reviewdog/action-golangci-lint@70498f2d1f75a55ee9a4d719e74e21ed68aebea3 # renovate: tag=v2 diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml new file mode 100644 index 00000000..90c6fbb5 --- /dev/null +++ b/.github/workflows/stale.yaml @@ -0,0 +1,28 @@ +--- +name: stale +on: + schedule: + - cron: 30 1 * * * + +permissions: + issues: write + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + stale: + runs-on: ubuntu-latest + steps: + # Config Options: https://github.com/actions/stale#list-of-input-options + - uses: actions/stale@532554b8a8498a0e006fbcde824b048728c4178f # renovate: tag=v5 + with: + days-before-stale: 30 + days-before-close: 5 + stale-issue-message: ๐Ÿค– This has been flagged as stale. If it is still relevant please post an update with context, otherwise this will shortly be closed. _You can always reopen a closed issue. This is not a permanent delete._ + stale-pr-message: ๐Ÿค– This is being marked as stale due to no recent activity. Update to keep this open. + stale-issue-label: stale-issue + exempt-issue-labels: pinned + stale-pr-label: stale-pr + exempt-draft-pr: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d9d5e59c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +--- +name: test +on: + pull_request: + push: + branches: + - main + tags: + - v* + workflow_dispatch: +permissions: + contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + + # https://github.com/magnetikonline/action-golang-cache + - name: Setup Golang with cache + uses: magnetikonline/action-golang-cache@09043845c4b214830a4ae9eb6f5c61d3d3fd37b0 # renovate: tag=v3 + with: + go-version-file: go.mod + + - name: mage-tidy + uses: magefile/mage-action@5f7a9a23cfef763949ca41834b868167adbd1b59 # renovate: tag=v2 + with: + version: latest + args: go:tidy + + - name: mage-test + uses: magefile/mage-action@5f7a9a23cfef763949ca41834b868167adbd1b59 # renovate: tag=v2 + with: + version: latest + args: go:testsum ./... + env: + # Race conditions will be hit due to the cli driven tasks and binaries being called. + GOTEST_DISABLE_RACE: 1 diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 00000000..24ba77a3 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,203 @@ +# Templates: https://github.com/zricethezav/gitleaks/tree/master/examples +title = "gitleaks config" + +[[rules]] + description = "AWS Access Key" + regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}''' + tags = ["key", "AWS"] + +[[rules]] + description = "AWS cred file info" + regex = '''(?i)(aws_access_key_id|aws_secret_access_key)(.{0,20})?=.[0-9a-zA-Z\/+]{20,40}''' + tags = ["AWS"] + +[[rules]] + description = "AWS Secret Key" + regex = '''(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]''' + tags = ["key", "AWS"] + +[[rules]] + description = "AWS MWS key" + regex = '''amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}''' + tags = ["key", "AWS", "MWS"] + +[[rules]] + description = "Facebook Secret Key" + regex = '''(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]''' + tags = ["key", "Facebook"] + +[[rules]] + description = "Facebook Client ID" + regex = '''(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]''' + tags = ["key", "Facebook"] + +[[rules]] + description = "Twitter Secret Key" + regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{35,44}['\"]''' + tags = ["key", "Twitter"] + +[[rules]] + description = "Twitter Client ID" + regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{18,25}['\"]''' + tags = ["client", "Twitter"] + +[[rules]] + description = "Github" + regex = '''(?i)github(.{0,20})?(?-i)['\"][0-9a-zA-Z]{35,40}['\"]''' + tags = ["key", "Github"] + +[[rules]] + description = "LinkedIn Client ID" + regex = '''(?i)linkedin(.{0,20})?(?-i)['\"][0-9a-z]{12}['\"]''' + tags = ["client", "LinkedIn"] + +[[rules]] + description = "LinkedIn Secret Key" + regex = '''(?i)linkedin(.{0,20})?['\"][0-9a-z]{16}['\"]''' + tags = ["secret", "LinkedIn"] + +[[rules]] + description = "Slack" + regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?''' + tags = ["key", "Slack"] + +[[rules]] + description = "EC" + regex = '''-----BEGIN EC PRIVATE KEY-----''' + tags = ["key", "EC"] + + +[[rules]] + description = "Google API key" + regex = '''AIza[0-9A-Za-z\\-_]{35}''' + tags = ["key", "Google"] + + +[[rules]] + description = "Heroku API key" + regex = '''(?i)heroku(.{0,20})?['"][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"]''' + tags = ["key", "Heroku"] + +[[rules]] + description = "MailChimp API key" + regex = '''(?i)(mailchimp|mc)(.{0,20})?['"][0-9a-f]{32}-us[0-9]{1,2}['"]''' + tags = ["key", "Mailchimp"] + +[[rules]] + description = "Mailgun API key" + regex = '''(?i)(mailgun|mg)(.{0,20})?['"][0-9a-z]{32}['"]''' + tags = ["key", "Mailgun"] + +[[rules]] + description = "PayPal Braintree access token" + regex = '''access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}''' + tags = ["key", "Paypal"] + +[[rules]] + description = "Picatic API key" + regex = '''sk_live_[0-9a-z]{32}''' + tags = ["key", "Picatic"] + +[[rules]] + description = "Slack Webhook" + regex = '''https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}''' + tags = ["key", "slack"] + +[[rules]] + description = "Stripe API key" + regex = '''(?i)stripe(.{0,20})?['\"][sk|rk]_live_[0-9a-zA-Z]{24}''' + tags = ["key", "Stripe"] + +[[rules]] + description = "Square access token" + regex = '''sq0atp-[0-9A-Za-z\-_]{22}''' + tags = ["key", "square"] + +[[rules]] + description = "Square OAuth secret" + regex = '''sq0csp-[0-9A-Za-z\\-_]{43}''' + tags = ["key", "square"] + +[[rules]] + description = "Twilio API key" + regex = '''(?i)twilio(.{0,20})?['\"][0-9a-f]{32}['\"]''' + tags = ["key", "twilio"] + +[[rules]] + description = "Env Var" + regex = '''(?i)(apikey|secret|key|api|password|pass|pw|host)=[0-9a-zA-Z-_.{}]{4,120}''' + +[[rules]] + description = "Port" + regex = '''(?i)port(.{0,4})?[0-9]{1,10}''' + [rules.allowlist] + regexes = ['''(?i)port '''] + description = "ignore export " + + + +[[rules]] + description = "Email" + regex = '''[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}''' + tags = ["email"] + [rules.allowlist] + files = ['''(?i)bashrc'''] + regexes = [ + '''(semverbot@github.com)''' + ] + description = "ignore bashrc emails" + + +[[rules]] + description = "Generic Credential" + regex = '''(?i)(dbpasswd|dbuser|dbname|dbhost|api_key|apikey|secret|key|api|password|user|guid|hostname|pw|auth)(.{0,20})?['|"]([0-9a-zA-Z-_\/+!{}/=]{4,120})['|"]''' + tags = ["key", "API", "generic"] + # ignore leaks with specific identifiers like slack and aws + [rules.allowlist] + description = "ignore slack, mailchimp, aws" + regexes = [ + '''xox[baprs]-([0-9a-zA-Z]{10,48})''', + '''(?i)(.{0,20})?['"][0-9a-f]{32}-us[0-9]{1,2}['"]''', + '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}''' + ] + +# [[rules]] +# description = "High Entropy" +# regex = '''[0-9a-zA-Z-_!{}/=]{4,120}''' +# file = '''(?i)(dump.sql|high-entropy-misc.txt)$''' +# tags = ["entropy"] +# [[rules.Entropies]] +# Min = "4.3" +# Max = "7.0" +# [rules.allowlist] +# description = "ignore ssh key and pems" +# files = ['''(pem|ppk|env)$'''] +# paths = ['''(.*)?ssh'''] + +# [[rules]] +# description = "Potential bash var" +# regex='''(?i)(=)([0-9a-zA-Z-_!{}=]{4,120})''' +# tags = ["key", "bash", "API", "generic"] +# [[rules.Entropies]] +# Min = "3.5" +# Max = "4.5" +# Group = "1" + +[[rules]] + description = "WP-Config" + regex='''define(.{0,20})?(DB_CHARSET|NONCE_SALT|LOGGED_IN_SALT|AUTH_SALT|NONCE_KEY|DB_HOST|DB_PASSWORD|AUTH_KEY|SECURE_AUTH_KEY|LOGGED_IN_KEY|DB_NAME|DB_USER)(.{0,20})?['|"].{10,120}['|"]''' + tags = ["key", "API", "generic"] + +# [[rules]] +# description = "Files with keys and credentials" +# files = '''(?i)(id_rsa|passwd|id_rsa.pub|pgpass|pem|key|shadow)''' + +[allowlist] +description = "global allow lists" +paths = [ + '''gitleaks.toml''', + '''(.*?)(jpg|gif|doc|docx|zip|xls|pdf|bin|svg|socket)$''', + '''(go.mod|go.sum)$''', + '''node_modules''', + '''vendor''', +] \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index af2479f9..9010b1c1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,54 +1,57 @@ +--- +dist: .artifacts/goreleaser # Visit https://goreleaser.com for documentation on how to customize this # behavior. before: hooks: # this is just an example and not a requirement for provider building/publishing - go mod tidy + - tfplugindocs generate --tf-version 1.2.8 --examples-dir examples # move this to mage later, since it is slow builds: -- env: - # goreleaser does not work with CGO, it could also complicate - # usage by users in CI/CD systems like Terraform Cloud where - # they are unable to install libraries. - - CGO_ENABLED=0 - mod_timestamp: '{{ .CommitTimestamp }}' - flags: - - -trimpath - ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' - goos: - - freebsd - - windows - - linux - - darwin - goarch: - - amd64 - - '386' - - arm - - arm64 - ignore: - - goos: darwin - goarch: '386' - binary: '{{ .ProjectName }}_v{{ .Version }}' + - env: + # goreleaser does not work with CGO, it could also complicate + # usage by users in CI/CD systems like Terraform Cloud where + # they are unable to install libraries. + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} + goos: + - freebsd + - windows + - linux + - darwin + goarch: + - amd64 + - '386' + - arm + - arm64 + ignore: + - goos: darwin + goarch: '386' + binary: '{{ .ProjectName }}_v{{ .Version }}' archives: -- format: zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + - format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' algorithm: sha256 signs: - artifacts: checksum args: - # if you are using this in a GitHub action or some other automated pipeline, you + # if you are using this in a GitHub action or some other automated pipeline, you # need to pass the batch flag to indicate its not interactive. - - "--batch" - - "--local-user" - - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key - - "--output" - - "${signature}" - - "--detach-sign" - - "${artifact}" + - --batch + - --local-user + - '{{ .Env.GPG_FINGERPRINT }}' # set this environment variable for your signing key + - --output + - ${signature} + - --detach-sign + - ${artifact} release: # If you want to manually examine the release before its live, uncomment this line: # draft: true changelog: - skip: true \ No newline at end of file + skip: true diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 00000000..20755348 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,59 @@ +--- +# +# An example .markdownlint-cli2.yaml file +# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md +# CLI: https://github.com/DavidAnson/markdownlint-cli2/README.md +# Disable some built-in rules +config: + no-trailing-spaces: false + no-multiple-blanks: false + MD007: + indent: 4 + no-hard-tabs: true + whitespace: true + no-bare-urls: true + + fenced-code-language: true + no-inline-html: false + MD004: + style: dash + MD025: false + MD041: false + MD013: false + MD046: + style: consistent + MD010: false + + #MD032: false +# Include a custom rule package +# customRules: +# - markdownlint-rule-titlecase + +# Fix any fixable errors +fix: true + +# Define a custom front matter pattern +frontMatter: [^]* + +# Define glob expressions to use (only valid at root) +globs: + - '!*bout.md' + +# Define glob expressions to ignore +ignores: + - ignore*.md + +# Use a plugin to recognize math +# markdownItPlugins: +# - +# - "@iktakahiro/markdown-it-katex" + +# Disable inline config comments +noInlineConfig: true + +# Disable progress on stdout (only valid at root) +noProgress: true + +# Use a specific formatter (only valid at root) +outputFormatters: + - - markdownlint-cli2-formatter-default diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..6c1cc1ad --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,114 @@ +--- +# Setup: pre-commit install +# Upgrade: pre-commit autoupdate +# Run: pre-commit run --all-files +# https://pre-commit.com/hooks.html +default_language_version: + # force all unspecified python hooks to run python3 + python: python3 + node: 16.15.0 +exclude: | + (?x)( + ^.devcontainer/| + ^.cache/| + ^.artifacts/| + ^vendor/| + ^vendir.lock.yml$| + vendor/ + ) +default_stages: [commit, push] +repos: + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + # https://github.com/jumanjihouse/pre-commit-hook-yamlfmt#override-defaults + # https://yaml.readthedocs.io/en/latest/example.html + rev: 0.2.2 # or specific tag + hooks: + - id: yamlfmt + types_or: [yaml] + args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '999'] + - repo: https://github.com/Yelp/detect-secrets + rev: v1.3.0 + hooks: + - name: detect-secrets + id: detect-secrets + stages: [commit] + args: [--disable-plugin, KeywordDetector, --exclude-files, .gitleaks.toml, --exclude-files, .trunk/trunk.yaml] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.27.1 # or higher tag + hooks: + - id: yamllint + types_or: [yaml] + args: [--format, parsable, --strict, --config-file, .yamllint.yaml] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 # Use the ref you want to point at + hooks: + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: check-case-conflict + name: Prevent case conflicts + - id: detect-aws-credentials + args: [--allow-missing-credentials] + - id: mixed-line-ending + name: Normalize line endings to lf + args: [--fix=lf] + - id: fix-byte-order-marker + + - id: check-added-large-files + name: No large files, use artifacts for that + - id: check-merge-conflict + name: Prevent merge markers being committed + - id: forbid-new-submodules + name: Don't allow git submodules + pass_filenames: false + - id: no-commit-to-branch + name: Don't commit to main + args: [--branch, master, --branch, main] + pass_filenames: false + + - repo: https://gitlab.com/bmares/check-json5 + rev: v1.0.0 + hooks: + - id: check-json5 + - repo: local + hooks: + - id: golines + name: go-fmt + description: Run formatter against changed files + entry: golines --base-formatter="gofumpt" -w --max-len=120 --no-reformat-tags + types: [go] + language: system + pass_filenames: true + - id: golangci-lint + name: golangci-lint + description: Fast linters runner for Go. + entry: golangci-lint run --fix --timeout 15s --new-from-rev=HEAD~ + types: [go] + language: system + pass_filenames: false + - id: go-test-all + name: go-test-all + description: Run integration tests for go + entry: gotestsum --format pkgname -- -shuffle=on -race -tags integration ./... + stages: [commit] + types: [go] + language: system + pass_filenames: false + verbose: true + - id: go-mod-tidy + name: go-mod-tidy + description: Run go mod tidy + entry: go mod tidy + stages: [commit] + types: [go] + language: golang + pass_filenames: false + verbose: true + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.5.1 + hooks: + - id: markdownlint-cli2 + - repo: https://github.com/zricethezav/gitleaks + rev: v8.11.0 + hooks: + - id: gitleaks + name: gitleaks-scan diff --git a/.whitesource b/.whitesource new file mode 100644 index 00000000..e467438d --- /dev/null +++ b/.whitesource @@ -0,0 +1,25 @@ +{ + "scanSettings": { + "configMode": "AUTO", + "configExternalURL": "", + "projectToken": "", + "baseBranches": [], + "enableLicenseViolations": true, + "displayLicenseViolations": false + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff", + "useMendCheckNames": true + }, + "issueSettings": { + "minSeverityLevel": "NONE", + "issueType": "DEPENDENCY" + }, + "remediateSettings": { + "enableRenovate": true, + "workflowRules": { + "enabled": true + } + } +} diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..c14dff5f --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,20 @@ +--- +extends: default +rules: + line-length: disable + + comments: + require-starting-space: false + ignore-shebangs: true + min-spaces-from-content: 1 + comments-indentation: disable + + truthy: + allowed-values: ['true', 'false'] + check-keys: false # this eliminates on: in github actions from being a failure + +# For all rules +ignore: | + .markdownlint-cli2.yaml + .licenses/ + docs/godocs/ diff --git a/docs/index.md b/docs/index.md index d0e9adf2..46e861ee 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,15 +1,32 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "dsv Provider" + +# generated by + +page_title: "DSV Provider" subcategory: "" description: |- - + Delinea DevOps Secrets Vault provider makes Secrets data available and provisions client secrets for existing roles. --- # Delinea DevOps Secrets Vault - Terraform Provider The [Delinea](https://delinea.com/) [DevOps Secrets Vault](https://delinea.com/products/devops-secrets-management-vault) (DSV) [Terraform](https://www.terraform.io/) Provider makes Secrets data available and provisions client secrets for existing roles. + +## Schema + +### Required + +- `tenant` (String) The DevOps Secrets Vault tenant + +### Optional + +- `auth_provider` (String) The DevOps Secrets Vault auth_provider +- `client_id` (String) The DevOps Secrets Vault client_id +- `client_secret` (String, Sensitive) The DevOps Secrets Vault client_secret +- `tld` (String) The DSV tenant top-level domain +- `url_template` (String) The DSV SDK API URL template + ## Example Usage For Terraform 0.13+, include the `terraform` block in your configuration or plan to that specifies the provider: @@ -35,13 +52,68 @@ dsv_role_name = "example-role" dsv_secret_path = "/path/to/a/test/secret" ``` -### Required +```terraform +variable "dsv_client_id" { + type = string +} -- `client_id` (String) The DevOps Secrets Vault client_id -- `client_secret` (String, Sensitive) The DevOps Secrets Vault client_secret -- `tenant` (String) The DevOps Secrets Vault tenant +variable "dsv_client_secret" { + type = string +} -### Optional +variable "dsv_auth_provider" { + type = string +} -- `tld` (String) The DSV tenant top-level domain -- `url_template` (String) The DSV SDK API URL template +variable "dsv_tenant" { + type = string +} + +variable "dsv_role_name" { + type = string +} + +variable "dsv_secret_path" { + type = string +} + +provider "dsv" { + client_id = var.dsv_client_id + client_secret = var.dsv_client_secret + tenant = var.dsv_tenant +} + +data "dsv_secret" "username" { + path = var.dsv_secret_path + element = "username" +} + +data "dsv_secret" "password" { + path = var.dsv_secret_path + element = "password" +} + +data "dsv_role" "existing_role" { + name = var.dsv_role_name +} + +resource "dsv_client" "new_client" { + role = data.dsv_role.existing_role.name +} + +output "client_id" { + value = dsv_client.new_client.client_id +} + +output "client_secret" { + value = dsv_client.new_client.client_secret +} + +output "username" { + value = data.dsv_secret.username.contents +} + +output "password" { + value = data.dsv_secret.password.contents +} +``` diff --git a/example.tf b/examples/example.tf similarity index 100% rename from example.tf rename to examples/example.tf diff --git a/go.mod b/go.mod index 0a537683..80089704 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,18 @@ module github.com/DelineaXPM/terraform-provider-dsv/v2 -require github.com/hashicorp/terraform v0.12.14 +require ( + github.com/DelineaXPM/dsv-sdk-go/v2 v2.0.1-0.20220719195420-2376a5c350ab + github.com/hashicorp/terraform v0.12.14 + github.com/magefile/mage v1.13.0 + github.com/pterm/pterm v0.12.45 + github.com/sheldonhull/magetools v0.0.12 +) require ( + atomicgo.dev/cursor v0.1.1 // indirect + atomicgo.dev/keyboard v0.2.8 // indirect + bitbucket.org/creachadair/shell v0.0.7 // indirect cloud.google.com/go v0.45.1 // indirect - github.com/DelineaXPM/dsv-sdk-go/v2 v2.0.1-0.20220719195420-2376a5c350ab // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-cidr v1.0.1 // indirect github.com/apparentlymart/go-textseg v1.0.0 // indirect @@ -12,13 +20,17 @@ require ( github.com/aws/aws-sdk-go v1.44.56 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/bitfield/script v0.20.2 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/bmatcuk/doublestar v1.1.5 // indirect - github.com/fatih/color v1.7.0 // indirect + github.com/containerd/console v1.0.3 // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/fatih/color v1.9.0 // indirect github.com/golang/protobuf v1.3.2 // indirect - github.com/google/go-cmp v0.3.1 // indirect + github.com/google/go-cmp v0.5.7 // indirect github.com/google/uuid v1.1.1 // indirect github.com/googleapis/gax-go/v2 v2.0.5 // indirect + github.com/gookit/color v1.5.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.6.1 // indirect @@ -34,10 +46,15 @@ require ( github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 // indirect github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 // indirect github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect + github.com/itchyny/gojq v0.12.7 // indirect + github.com/itchyny/timefmt-go v0.1.3 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.11.2 // indirect - github.com/mattn/go-colorable v0.1.1 // indirect - github.com/mattn/go-isatty v0.0.5 // indirect + github.com/lithammer/fuzzysearch v1.1.5 // indirect + github.com/logrusorgru/aurora v2.0.3+incompatible // indirect + github.com/mattn/go-colorable v0.1.4 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mitchellh/cli v1.0.0 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -48,17 +65,23 @@ require ( github.com/mitchellh/reflectwalk v1.0.0 // indirect github.com/oklog/run v1.0.0 // indirect github.com/posener/complete v1.2.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/spf13/afero v1.2.1 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect + github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect github.com/zclconf/go-cty v1.1.0 // indirect github.com/zclconf/go-cty-yaml v1.0.1 // indirect + github.com/ztrue/tracerr v0.3.0 // indirect go.opencensus.io v0.22.0 // indirect - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect + golang.org/x/mod v0.5.1 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/api v0.9.0 // indirect google.golang.org/appengine v1.6.1 // indirect google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect diff --git a/go.sum b/go.sum index 7835d95b..53f364ea 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,9 @@ +atomicgo.dev/cursor v0.1.1 h1:0t9sxQomCTRh5ug+hAMCs59x/UmC9QL6Ci5uosINKD4= +atomicgo.dev/cursor v0.1.1/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= +atomicgo.dev/keyboard v0.2.8 h1:Di09BitwZgdTV1hPyX/b9Cqxi8HVuJQwWivnZUEqlj4= +atomicgo.dev/keyboard v0.2.8/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= +bitbucket.org/creachadair/shell v0.0.7 h1:Z96pB6DkSb7F3Y3BBnJeOZH2gazyMTWlvecSD4vDqfk= +bitbucket.org/creachadair/shell v0.0.7/go.mod h1:oqtXSSvSYr4624lnnabXHaBsYW6RD80caLi2b3hJk0U= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -15,6 +21,14 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/DelineaXPM/dsv-sdk-go/v2 v2.0.1-0.20220719195420-2376a5c350ab h1:Oy5BHXmkh0FZii3XkzwJvvS9JiNRcBaa8GrhqfdJRyA= github.com/DelineaXPM/dsv-sdk-go/v2 v2.0.1-0.20220719195420-2376a5c350ab/go.mod h1:VOkrPSbAV+9cB/5vfDej87dcNpjUrcGbfAiN6Z3f9LI= +github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= +github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8= +github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII= +github.com/MarvinJWendt/testza v0.2.10/go.mod h1:pd+VWsoGUiFtq+hRKSU1Bktnn+DMCSrDrXDpX2bG66k= +github.com/MarvinJWendt/testza v0.2.12/go.mod h1:JOIegYyV7rX+7VZ9r77L/eH6CfJHHzXjB69adAhzZkI= +github.com/MarvinJWendt/testza v0.3.0/go.mod h1:eFcL4I0idjtIx8P9C6KkAuLgATNKpX4/2oUqKc6bF2c= +github.com/MarvinJWendt/testza v0.4.2 h1:Vbw9GkSB5erJI2BPnBL9SVGV9myE+XmUSFahBGUhW2Q= +github.com/MarvinJWendt/testza v0.4.2/go.mod h1:mSdhXiKH8sg/gQehJ63bINcCKp7RtYewEjXsvsVUPbE= github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= @@ -40,6 +54,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.56 h1:bT+lExwagH7djxb6InKUVkEKGPAj5aAPnV85/m1fKro= @@ -50,6 +65,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1U github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitfield/script v0.20.2 h1:4DexsRtBILVMEn3EZwHbtJdDqdk43sXI8gM3F04JXgs= +github.com/bitfield/script v0.20.2/go.mod h1:l3AZPVAtKQrL03bwh7nlNTUtgrgSWurpJSbtqspYrOA= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmatcuk/doublestar v1.1.5 h1:2bNwBOmhyFEFcoB3tGvTD5xanq+4kyOZlB8wFYbMjkk= @@ -61,6 +78,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= +github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -72,10 +91,13 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v0.0.0-20180920040454-5637cf3d8a31/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -102,8 +124,11 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -114,6 +139,9 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= +github.com/gookit/color v1.5.0 h1:1Opow3+BWDwqor78DcJkJCIwnkviFi+rrOANki9BUFw= +github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= github.com/gophercloud/gophercloud v0.0.0-20190208042652-bc37892e1968/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= github.com/gophercloud/utils v0.0.0-20190128072930-fbb6ab446f01/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -183,6 +211,10 @@ github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bA github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/itchyny/gojq v0.12.7 h1:hYPTpeWfrJ1OT+2j6cvBScbhl0TkdwGM4bc66onUSOQ= +github.com/itchyny/gojq v0.12.7/go.mod h1:ZdvNHVlzPgUf8pgjnuDTmGfHA/21KoutQUJ3An/xNuw= +github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= +github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -200,6 +232,10 @@ github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALr github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ= github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= +github.com/klauspost/cpuid/v2 v2.0.12 h1:p9dKCg8i4gmOxtv35DvrYoWqYzQrvEVdjQ762Y0OqZE= +github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -211,18 +247,33 @@ github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LE github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lithammer/fuzzysearch v1.1.5 h1:Ag7aKU08wp0R9QCfF4GoGST9HbmAIeLP7xwMrOBEp1c= +github.com/lithammer/fuzzysearch v1.1.5/go.mod h1:1R1LRNk7yKid1BaQkmuLQaHruxcC4HmAH30Dh61Ih1Q= +github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= +github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84= +github.com/magefile/mage v1.13.0 h1:XtLJl8bcCM7EFoO8FyH8XK3t7G5hQAeK+i4tq+veT9M= +github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= github.com/masterzen/winrm v0.0.0-20190223112901-5e5c9a7fe54b/go.mod h1:wr1VqkwW0AB5JS0QLy5GpVMS9E3VtRoSYXUYyVk46KY= +github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -275,11 +326,25 @@ github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1: github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/pterm/pterm v0.12.27/go.mod h1:PhQ89w4i95rhgE+xedAoqous6K9X+r6aSOI2eFF7DZI= +github.com/pterm/pterm v0.12.29/go.mod h1:WI3qxgvoQFFGKGjGnJR849gU0TsEOvKn5Q8LlY1U7lg= +github.com/pterm/pterm v0.12.30/go.mod h1:MOqLIyMOgmTDz9yorcYbcw+HsgoZo3BQfg2wtl3HEFE= +github.com/pterm/pterm v0.12.31/go.mod h1:32ZAWZVXD7ZfG0s8qqHXePte42kdz8ECtRyEejaWgXU= +github.com/pterm/pterm v0.12.33/go.mod h1:x+h2uL+n7CP/rel9+bImHD5lF3nM9vJj80k9ybiiTTE= +github.com/pterm/pterm v0.12.36/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8= +github.com/pterm/pterm v0.12.40/go.mod h1:ffwPLwlbXxP+rxT0GsgDTzS3y3rmpAO1NMjUkGTYf8s= +github.com/pterm/pterm v0.12.45 h1:5HATKLTDjl9D74b0x7yiHzFI7OADlSXK3yHrJNhRwZE= +github.com/pterm/pterm v0.12.45/go.mod h1:hJgLlBafm45w/Hr0dKXxY//POD7CgowhePaG1sdPNBg= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sheldonhull/magetools v0.0.12 h1:e1nQbjn98gP/J0YmK/m9Q5qxpgfmlf90BHo1RA9/jAQ= +github.com/sheldonhull/magetools v0.0.12/go.mod h1:Ob0AYGrO9YdoBIyvCq0yZM9xJ0y4GGJqgmoIO5LW/KU= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= @@ -291,8 +356,11 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d/go.mod h1:BSTlc8jOjh0niykqEGVXOLXdi9o0r0kR8tCYiMvjFgw= github.com/terraform-providers/terraform-provider-openstack v1.15.0/go.mod h1:2aQ6n/BtChAl1y2S60vebhyJyZXBsuAI5G4+lHrT1Ew= github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -307,11 +375,15 @@ github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6Ac github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty-yaml v1.0.1 h1:up11wlgAaDvlAGENcFDnZgkn0qUJurso7k6EpURKNF8= github.com/zclconf/go-cty-yaml v1.0.1/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0= +github.com/ztrue/tracerr v0.3.0 h1:lDi6EgEYhPYPnKcjsYzmWw4EkFEoA/gfe+I9Y5f+h6Y= +github.com/ztrue/tracerr v0.3.0/go.mod h1:qEalzze4VN9O8tnhBXScfCrmoJo10o8TN5ciKjm6Mww= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -325,8 +397,9 @@ golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -336,6 +409,8 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -382,10 +457,21 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e h1:w36l2Uw3dRan1K3TyXriXvY+6T56GNmlKGcqiQUJDfM= golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -404,6 +490,9 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -429,8 +518,9 @@ google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -439,8 +529,12 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/magefiles/constants/constants.mage.go b/magefiles/constants/constants.mage.go new file mode 100644 index 00000000..05ae3c15 --- /dev/null +++ b/magefiles/constants/constants.mage.go @@ -0,0 +1,14 @@ +package constants + +// Since we are dealing with builds, having a constants file until using a config input makes it easy. + +const ( + // ArtifactDirectory is a directory containing artifacts for the project and shouldn't be committed to source. + ArtifactDirectory = ".artifacts" + + // PermissionUserReadWriteExecute is the permissions for the artifact directory. + PermissionUserReadWriteExecute = 0o0700 + + // CacheDirectory is where the cache for the project is placed, ie artifacts that don't need to be rebuilt often. + CacheDirectory = ".cache" +) diff --git a/magefiles/dev-cli-tools.go b/magefiles/dev-cli-tools.go new file mode 100644 index 00000000..89705b7a --- /dev/null +++ b/magefiles/dev-cli-tools.go @@ -0,0 +1,22 @@ +package main + +// tools is a list of tools that are installed as binaries for development usage. +// This list gets installed to go bin directory once `mage init` is run. +// This is for binaries that need to be invoked as cli tools, not packages. +var ToolList = []string{ //nolint:gochecknoglobals // ok to be global for tooling setup + "github.com/golangci/golangci-lint/cmd/golangci-lint@latest", + "mvdan.cc/gofumpt@latest", + "github.com/daixiang0/gci@latest", + "github.com/goreleaser/goreleaser@latest", + "github.com/iwittkau/mage-select@latest", + "github.com/mfridman/tparse@latest", // Tparse provides nice formatted go test console output. + "github.com/rakyll/gotest@latest", // Gotest is a wrapper for running Go tests via command line with support for colors to make it more readable. + "gotest.tools/gotestsum@latest", // Gotestsum provides improved console output for tests as well as additional test output for CI systems. + "github.com/gechr/yamlfmt@latest", // Yamlfmt provides formatting standards for yaml files. + "honnef.co/go/tools/cmd/staticcheck@latest", // staticcheck provides an alternative linter. + "github.com/bitfield/gotestdox/cmd/gotestdox@latest", // gotestdox provides word based output on tests. + "github.com/git-town/git-town@latest", // git-town provides git/github workflow for quick branching + "github.com/chriswalz/bit@latest", // bit provides a helper cli tool for git with autocompletion + + "github.com/hashicorp/terraform-plugin-doc", // generate documentation +} diff --git a/magefiles/goreleaser.mage.go b/magefiles/goreleaser.mage.go new file mode 100644 index 00000000..efddc056 --- /dev/null +++ b/magefiles/goreleaser.mage.go @@ -0,0 +1,89 @@ +package main + +import ( + "fmt" + "os" + + "github.com/magefile/mage/sh" + "github.com/pterm/pterm" + "github.com/sheldonhull/magetools/pkg/magetoolsutils" + "github.com/sheldonhull/magetools/pkg/req" +) + +func checkEnvVar(envVar string, required bool) (string, error) { + envVarValue := os.Getenv(envVar) + if envVarValue == "" && required { + pterm.Error.Printfln( + "%s is required and unable to proceed without this being provided. terminating task.", + envVar, + ) + return "", fmt.Errorf("%s is required", envVar) + } + if envVarValue == "" { + pterm.Debug.Printfln( + "checkEnvVar() found no value for: %q, however this is marked as optional, so not exiting task", + envVar, + ) + } + pterm.Debug.Printfln("checkEnvVar() found value: %q=%q", envVar, envVarValue) + return envVarValue, nil +} + +// ๐Ÿ”จ Build builds the project for the current platform. +func Build() error { + magetoolsutils.CheckPtermDebug() + binary, err := req.ResolveBinaryByInstall("goreleaser", "github.com/goreleaser/goreleaser@latest") + if err != nil { + return err + } + + releaserArgs := []string{ + "build", + "--rm-dist", + "--snapshot", + "--single-target", + } + pterm.Debug.Printfln("goreleaser: %+v", releaserArgs) + + return sh.RunV(binary, releaserArgs...) // "--skip-announce",. +} + +// ๐Ÿ”จ BuildAll builds all the binaries defined in the project, for all platforms. +// If there is no additional platforms configured in the task, then basically this will just be the same as `mage build`. +func BuildAll() error { + magetoolsutils.CheckPtermDebug() + binary, err := req.ResolveBinaryByInstall("goreleaser", "github.com/goreleaser/goreleaser@latest") + if err != nil { + return err + } + + return sh.RunV(binary, + "build", + "--rm-dist", + "--snapshot", + ) +} + +// ๐Ÿ”จ Release generates a release and validates the required environment variables are available. +func Release() error { + magetoolsutils.CheckPtermDebug() + binary, err := req.ResolveBinaryByInstall("goreleaser", "github.com/goreleaser/goreleaser@latest") + if err != nil { + return err + } + + if _, err = checkEnvVar("GITHUB_TOKEN", true); err != nil { + return err + } + if _, err = checkEnvVar("GPG_FINGERPRINT", true); err != nil { + return err + } + + releaserArgs := []string{ + "release", + "--rm-dist", + } + pterm.Debug.Printfln("goreleaser: %+v", releaserArgs) + + return sh.RunV(binary, releaserArgs...) +} diff --git a/magefiles/jobs.mage.go b/magefiles/jobs.mage.go new file mode 100644 index 00000000..ca7657d4 --- /dev/null +++ b/magefiles/jobs.mage.go @@ -0,0 +1,8 @@ +package main + +import ( + "github.com/magefile/mage/mg" +) + +// Job is a namespace to contain chained sets of automation actions, to reduce the need to chain many commands together for common workflows. +type Job mg.Namespace diff --git a/magefiles/mage.go b/magefiles/mage.go new file mode 100644 index 00000000..956b30df --- /dev/null +++ b/magefiles/mage.go @@ -0,0 +1,14 @@ +//go:build ignore + +// This file lets you run mage with a no-install option as long as you have go. +// To invoke just run go run main.go [task] [parameters] +// To use mage directly, install it, then run mage [task] [parameters] +package main + +import ( + "os" + + "github.com/magefile/mage/mage" +) + +func main() { os.Exit(mage.Main()) } diff --git a/magefiles/magefile.go b/magefiles/magefile.go new file mode 100644 index 00000000..cf4391e1 --- /dev/null +++ b/magefiles/magefile.go @@ -0,0 +1,88 @@ +// โšก Core Mage Tasks. +package main + +import ( + "os" + + "github.com/DelineaXPM/terraform-provider-dsv/v2/magefiles/constants" + + "github.com/magefile/mage/mg" + "github.com/pterm/pterm" + "github.com/sheldonhull/magetools/ci" + "github.com/sheldonhull/magetools/tooling" + + // mage:import + "github.com/sheldonhull/magetools/gittools" + // mage:import + "github.com/sheldonhull/magetools/gotools" + // mage:import + "github.com/sheldonhull/magetools/precommit" + //mage:import + _ "github.com/sheldonhull/magetools/secrets" +) + +// createDirectories creates the local working directories for build artifacts and tooling. +func createDirectories() error { + for _, dir := range []string{constants.ArtifactDirectory, constants.CacheDirectory} { + if err := os.MkdirAll(dir, constants.PermissionUserReadWriteExecute); err != nil { + pterm.Error.Printf("failed to create dir: [%s] with error: %v\n", dir, err) + + return err + } + pterm.Success.Printf("โœ… [%s] dir created\n", dir) + } + + return nil +} + +// Init runs multiple tasks to initialize all the requirements for running a project for a new contributor. +func Init() error { //nolint:deadcode // Not dead, it's alive. + pterm.DefaultHeader.Println("running Init()") + + if ci.IsCI() { + pterm.DefaultHeader.Println("CI detected, minimal init being applied") + pterm.Info.Println("Installing Core CI Dependencies") + if err := tooling.SilentInstallTools([]string{ + "github.com/goreleaser/goreleaser@latest", + "github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest", + }); err != nil { + return err + } + return nil + } + mg.SerialDeps( + Clean, + createDirectories, + (gotools.Go{}.Tidy), + (gotools.Go{}.Init), + ) + + if ci.IsCI() { + pterm.Debug.Println("CI detected, done with init") + return nil + } + + pterm.DefaultSection.Println("Setup Project Specific Tools") + if err := tooling.SilentInstallTools(ToolList); err != nil { + return err + } + // These can run in parallel as different toolchains. + mg.Deps( + (gittools.Gittools{}.Init), + (precommit.Precommit{}.Init), + ) + return nil +} + +// Clean up after yourself. +func Clean() { + pterm.Success.Println("Cleaning...") + for _, dir := range []string{constants.ArtifactDirectory, constants.CacheDirectory} { + err := os.RemoveAll(dir) + if err != nil { + pterm.Error.Printf("failed to removeall: [%s] with error: %v\n", dir, err) + } + pterm.Success.Printf("๐Ÿงน [%s] dir removed\n", dir) + } + mg.Deps(createDirectories) +} diff --git a/magefiles/tools.go b/magefiles/tools.go new file mode 100644 index 00000000..98da2c86 --- /dev/null +++ b/magefiles/tools.go @@ -0,0 +1,12 @@ +//go:build tools +// +build tools + +// Place this in build directory, tools directory, or anywhere else to avoid conflict with main package in the same directory. +// Tooling that Mage or other automation tools use, that is _not_ part of the core code base. +// This signifies to Go that these tools are build tooling and not part of the dependency chain for building the project. +// Additionally, it's ignored for everything like go build. +// To ensure these are downloaded, run go mod tidy + +package tools + +// _ "golang.org/x/tools/cmd/stringer" diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..8d45c063 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "DelineaXPM/renovate-config" + ] +} \ No newline at end of file diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 00000000..eec00860 --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,44 @@ +--- + +# generated by + +page_title: "DSV Provider" +subcategory: "" +description: |- + Delinea DevOps Secrets Vault provider makes Secrets data available and provisions client secrets for existing roles. +--- + +# Delinea DevOps Secrets Vault - Terraform Provider + +The [Delinea](https://delinea.com/) [DevOps Secrets Vault](https://delinea.com/products/devops-secrets-management-vault) (DSV) [Terraform](https://www.terraform.io/) Provider makes Secrets data available and provisions client secrets for existing roles. + +{{ .SchemaMarkdown | trimspace }} + +## Example Usage + +For Terraform 0.13+, include the `terraform` block in your configuration or plan to that specifies the provider: + +```terraform +terraform { + required_providers { + dsv = { + source = "terraform.delinea.com/delinea/dsv" + version = "~> 1.0" + } + } +} +``` + +To run the example, create a `terraform.tfvars`: + +```json +dsv_client_id = "a54bc1b6-7dd7-4fb1-a8ba-bbfa81820e40" +dsv_client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxx-xxxxx" +dsv_tenant = "mytenant" +dsv_role_name = "example-role" +dsv_secret_path = "/path/to/a/test/secret" +``` + + +{{ tffile "examples/example.tf" }} +