diff --git a/.devcontainer/default/devcontainer.json b/.devcontainer/default/devcontainer.json new file mode 100644 index 0000000..a1775e8 --- /dev/null +++ b/.devcontainer/default/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "Terraform Admin Guide Samples - Default", + "image": "mcr.microsoft.com/devcontainers/base:debian", + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/terraform:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/robbert229/devcontainer-features/opentofu:1": { + "version": "1.9.0" + } + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "HashiCorp.terraform", + "Github.copilot", + "gamunu.opentofu" + ] + }, + "codespaces": {} + }, + "hostRequirements": { + "memory": "4gb" + }, + // If you want to use SSO please install xdg-utils in the container + //"postCreateCommand": "bash ./.devcontainer/scripts/install-xdg.sh", + "remoteUser": "vscode" +} diff --git a/.devcontainer/withenvfile/devcontainer.json b/.devcontainer/withenvfile/devcontainer.json new file mode 100644 index 0000000..b35336f --- /dev/null +++ b/.devcontainer/withenvfile/devcontainer.json @@ -0,0 +1,38 @@ +{ + "name": "Terraform Admin Guide Samples - with env file", + "image": "mcr.microsoft.com/devcontainers/base:debian", + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/terraform:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/robbert229/devcontainer-features/opentofu:1": { + "version": "1.9.0" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "Github.copilot", + "HashiCorp.terraform", + "gamunu.opentofu" + ], + // Set *default* container specific settings.json values on container create. + "settings": {} + }, + "codespaces": {} + }, + "hostRequirements": { + "memory": "4gb" + }, + // If you want to use SSO please install xdg-utils in the container + //"postCreateCommand": "bash ./.devcontainer/scripts/install-xdg.sh", + "remoteUser": "vscode", + // This devcontainer expects a file named .devcontainer/devcontainer.env to exist. + // you should place the following environment variables in that file: + // - BTP_USERNAME + // - BTP_PASSWORD + "runArgs": [ + "--env-file", + ".devcontainer/devcontainer.env" + ] +} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..968e831 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# They will be requested for review when someone opens a +# pull request. +* @lechnerc77 @NHingerl @bzarske diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..db1900c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,52 @@ +name: 🐞 Bug report +description: File a bug/issue to help us improve +title: "[BUG]" +labels: [bug, needs-triage] +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: dropdown + id: area + attributes: + label: What type of issue are you facing + description: What type of issue are you facing? + options: + - bug report + - documentation issue + validations: + required: true + - type: textarea + attributes: + label: Describe the bug + description: Provide a clear and concise description of what the bug is. + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false + - type: textarea + attributes: + label: Add screenshots to help explain your problem + description: | + If applicable, add screenshots to help explain your problem. + + Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: textarea + attributes: + label: Additional context + description: | + Add any other context like links or references about the problem here. Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..e7bce23 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,43 @@ +name: 💡Feature request +description: Suggest an idea for this project +title: "[FEATURE]" +labels: [enhancement, pending-decision] +body: + - type: dropdown + attributes: + label: What area do you want to see improved? + description: Specify the main area that you want to see improved. + options: + - samples + - documentation + - other + validations: + required: true + - type: textarea + id: area + attributes: + label: Is your feature request related to a problem? Please describe. + description: Provide a clear and concise description of what the problem is e.g., I am always frustrated when [...] + validations: + required: true + - type: textarea + attributes: + label: Describe the solution you would like + description: A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you have considered + description: A clear and concise description of any alternative solutions or features you have considered. + validations: + required: false + - type: textarea + attributes: + label: Additional context + description: | + Add any other context like links or references about the problem here. Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..958dea7 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ +## Purpose + +- ... + +## Pull Request Type + +What kind of change does this Pull Request introduce? + +``` +[ ] Bugfix +[ ] Feature +[ ] Refactoring (no functional changes, no api changes) +[ ] Documentation content changes +[ ] Other... Please describe: +``` + +## Other Information + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c5cbed8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/feature-request-response.yml b/.github/workflows/feature-request-response.yml new file mode 100644 index 0000000..570e536 --- /dev/null +++ b/.github/workflows/feature-request-response.yml @@ -0,0 +1,31 @@ +name: "Feature Request - Community Note" + +on: + issues: + types: + - opened + +jobs: + community_note: + name: 'Add Community Note' + if: ${{ contains(github.event.issue.labels.*.name, 'enhancement') }} + runs-on: ubuntu-latest + steps: + - name: 'Add community note to new Issues' + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + with: + issue-number: ${{ github.event.issue.number }} + body: | + Thanks for the feature request. We evaluate it and update the issue accordingly. + + ## Community Note + + ### Voting for Prioritization + + * Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original post to help the community and maintainers prioritize this request. + * Please **do not** leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request. + + ### Volunteering to Work on This Issue + + * If you are interested in working on this issue, please leave a comment. + * If this would be your first contribution, please review the [contribution guide](https://github.com/SAP/terraform-exporter-btp/blob/main/CONTRIBUTING.md). diff --git a/.github/workflows/issue-comment-created.yml b/.github/workflows/issue-comment-created.yml new file mode 100644 index 0000000..13e3a84 --- /dev/null +++ b/.github/workflows/issue-comment-created.yml @@ -0,0 +1,14 @@ +name: Issue Comment Created Triage + +on: + issue_comment: + types: [created] + +jobs: + issue_comment_triage: + runs-on: ubuntu-latest + steps: + - uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1.3.0 + with: + labels: | + needs author feedback diff --git a/.github/workflows/links-watcher-cron.yml b/.github/workflows/links-watcher-cron.yml new file mode 100644 index 0000000..995930a --- /dev/null +++ b/.github/workflows/links-watcher-cron.yml @@ -0,0 +1,44 @@ +name: Periodic Link Checker + +on: + schedule: + - cron: "30 0 * * 1" + workflow_dispatch: + +permissions: + contents: read + issues: write + +jobs: + link-checker: + runs-on: ubuntu-latest + steps: + - name: "Checkout source code" + uses: actions/checkout@v4 + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2.3.0 + with: + args: --verbose --no-progress --max-concurrency 2 --exclude-loopback './**/*.md' + output: ./lychee/out.md + fail: true + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Find existing issue + id: find_issue + uses: micalevisk/last-issue-action@v2 + if: failure() + with: + state: open + labels: | + broken link + automated issue + - name: Create or update issue for broken links + uses: peter-evans/create-issue-from-file@v5 + if: failure() + with: + title: Link Checker Report + # If issue number is empty a new issue gets created + issue-number: ${{ steps.find_issue.outputs.issue-number }} + content-filepath: ./lychee/out.md + labels: broken link, automated issue diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml new file mode 100644 index 0000000..39a83a3 --- /dev/null +++ b/.github/workflows/semantic-pr.yml @@ -0,0 +1,24 @@ +# Linter to enforce semantic pull request titles (see https://www.conventionalcommits.org/en/v1.0.0/) +name: "Semantic PR Check" + +on: + pull_request_target: + types: + - opened + - edited + - reopened + - synchronize + - ready_for_review + +permissions: + pull-requests: read + +jobs: + main: + if: github.event.pull_request.draft == false + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/set-default-values-pr.yml b/.github/workflows/set-default-values-pr.yml new file mode 100644 index 0000000..2e88db0 --- /dev/null +++ b/.github/workflows/set-default-values-pr.yml @@ -0,0 +1,61 @@ + +name: Set default values to PR +# Add the PR to the central project (status in project is set via workflow in project) +# Add the creator of the PR as assignee +# Add the next available milestone to the PR + +on: + pull_request: + types: + - opened + +permissions: + issues: write + pull-requests: write + +jobs: + set-default-values: + runs-on: ubuntu-latest + steps: + - name: Add creator as assignee + if: ${{ github.actor != 'dependabot[bot]' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{github.repository}}/issues/${{github.event.number}}/assignees \ + -f "assignees[]=${{github.actor}}" + + - name: Set default labels + if: ${{ github.actor != 'dependabot[bot]' }} + uses: actions/github-script@v7 + env: + TITLE: ${{ github.event.pull_request.title }} + with: + script: | + const title = process.env.TITLE; + + let defaultLabels = []; + if (title.startsWith("feat:")) { + defaultLabels.push("enhancement"); + } else if (title.startsWith("fix:")) { + defaultLabels.push("bug"); + } else if (title.startsWith("docs:")) { + defaultLabels.push("documentation"); + } else if (title.startsWith("test:")) { + defaultLabels.push("test setup"); + } else if (title.startsWith("refactor:")) { + defaultLabels.push("refactoring"); + } else { + defaultLabels.push("internal"); + } + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: defaultLabels + }); diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml new file mode 100644 index 0000000..504c1ed --- /dev/null +++ b/.github/workflows/spellcheck.yml @@ -0,0 +1,22 @@ +name: Spell Checker +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + workflow_dispatch: +jobs: + check-spelling: + runs-on: ubuntu-latest + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + - name: Check Spelling + id: spellcheck + uses: rojopolis/spellcheck-github-actions@0.47.0 + with: + config_path: .spellcheck.yml + task_name: Markdown diff --git a/.github/workflows/stale-handling.yml b/.github/workflows/stale-handling.yml new file mode 100644 index 0000000..b7ba09a --- /dev/null +++ b/.github/workflows/stale-handling.yml @@ -0,0 +1,22 @@ +name: Close Stale Issues and PRs +on: + schedule: + - cron: '30 2 * * *' + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + stale-issue-message: 'This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'This pull request is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' + close-pr-message: 'This PR was closed because it has been stalled for 5 days with no activity.' + days-before-stale: 15 + days-before-close: 5 + any-of-issue-labels: 'needs-author-feedback' diff --git a/.github/workflows/terraform_format_check.yml b/.github/workflows/terraform_format_check.yml new file mode 100644 index 0000000..48a5f58 --- /dev/null +++ b/.github/workflows/terraform_format_check.yml @@ -0,0 +1,43 @@ +name: Terraform Format Check + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + workflow_dispatch: + +jobs: + terraform-fmt: + name: Validate Format of Terraform Files + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_wrapper: false + + - name: Get changed directories + id: changed-files + uses: tj-actions/changed-files@v45 + with: + dir_names: 'true' + + - name: Validate Terraform format + if: steps.changed-files.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + shell: bash + run: | + EXIT_CODE=0 + for file in ${ALL_CHANGED_FILES}; do + echo "Checking format of $file with terraform fmt" + terraform fmt -check -recursive "$file" || EXIT_CODE=$? + echo "Result is $EXIT_CODE" + done + exit $EXIT_CODE diff --git a/.github/workflows/terraform_validate.yml b/.github/workflows/terraform_validate.yml new file mode 100644 index 0000000..5aa40f5 --- /dev/null +++ b/.github/workflows/terraform_validate.yml @@ -0,0 +1,46 @@ +name: Terraform Validation Check + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + workflow_dispatch: + +jobs: + terraform-validate: + name: Validate Syntax of Terraform Files + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_wrapper: false + + - name: Get changed directories + id: changed-files + uses: tj-actions/changed-files@v45 + with: + dir_names: 'true' + + - name: Validate Terraform sytnax + if: steps.changed-files.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + shell: bash + run: | + EXIT_CODE=0 + for file in ${ALL_CHANGED_FILES}; do + echo "Validating Terraform files in $file with terraform fmt" + cd $file + terraform init -backend=false || EXIT_CODE=$? + terraform validate || EXIT_CODE=$? + rm -rf .terraform/ + cd ${{ github.workspace }} + done + exit $EXIT_CODE \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff2c4e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Ignore transient lock info files created by terraform apply +.terraform.tfstate.lock.info + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + +*.env diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 0000000..3582608 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,2 @@ +https?://localhost.* +https://developers.sap.com/* diff --git a/.spellcheck.yml b/.spellcheck.yml new file mode 100644 index 0000000..1660b01 --- /dev/null +++ b/.spellcheck.yml @@ -0,0 +1,25 @@ +matrix: + - name: Markdown + expect_match: false + apsell: + mode: en + dictionary: + wordlists: + - .wordlist.txt + encoding: utf-8 + pipeline: + - pyspelling.filters.markdown: + markdown_extensions: + - markdown.extensions.extra: + - pyspelling.filters.html: + comments: false + attributes: + - alt + ignores: + - ":matches(code, pre)" + - "code" + - "pre" + - "blockquote" + sources: + - "**/*.md" + default_encoding: utf-8 diff --git a/.wordlist.txt b/.wordlist.txt new file mode 100644 index 0000000..dff76d1 --- /dev/null +++ b/.wordlist.txt @@ -0,0 +1,77 @@ +APIs +autocompletion +APIs +backend +Backend +breakpoint +BTP +btp +CLA +CLI +CLIs +CodeQL +config +Copilot +customizations +DCO +dependabot +devcontainer +devcontainers +dir +faq +Github +github +GLOBALACCOUNT +html +https +HCL +HashiCorp +IdP +json +JSON +js +JS +jq +macOS +md +NextSteps +OAuth +OpenSSF +OpenTofu +PEM +Pre +pre +PowerShell +powershell +README +readme +runtime +spf +SSO +sso +subaccount +Subaccount +subaccounts +subaccount's +subcommands +TBD +templating +Terraform +Terraform's +terraform +Terraform's +Terramate +tf +TLS +toml +TOML +toolchain +UIs +UI +VS +workspace +workspaces +YAML +yaml +yml +zsh diff --git a/REUSE.toml b/REUSE.toml index 2dd2d43..8faa779 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -1,23 +1,11 @@ version = 1 -SPDX-PackageName = "" -SPDX-PackageSupplier = "" -SPDX-PackageDownloadLocation = "" +SPDX-PackageName = "btp-admin-guide-samples" +SPDX-PackageSupplier = "ospo@sap.com" +SPDX-PackageDownloadLocation = "https://github.com/sap-samples/btp-admin-guide-samples" SPDX-PackageComment = "The code in this project may include calls to APIs (\"API Calls\") of\n SAP or third-party products or services developed outside of this project\n (\"External Products\").\n \"APIs\" means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n project's code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls." [[annotations]] -path = "" +path = "**" precedence = "aggregate" -SPDX-FileCopyrightText = " SAP SE or an SAP affiliate company and contributors" +SPDX-FileCopyrightText = "2015 SAP SE or an SAP affiliate company and btp-admin-guide-samples contributors" SPDX-License-Identifier = "Apache-2.0" - -[[annotations]] -path = "" -precedence = "aggregate" -SPDX-FileCopyrightText = "" -SPDX-License-Identifier = "" - -[[annotations]] -path = "" -precedence = "aggregate" -SPDX-FileCopyrightText = "" -SPDX-License-Identifier = ""