-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a754d20
Showing
16 changed files
with
660 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "Terraform provider for SAP BTP - 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": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": {}, | ||
"extensions": [ | ||
"HashiCorp.terraform" | ||
] | ||
}, | ||
"codespaces": {} | ||
}, | ||
"hostRequirements": { | ||
"memory": "4gb" | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "Terraform provider for SAP BTP - 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": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": {}, | ||
"extensions": [ | ||
"HashiCorp.terraform" | ||
] | ||
}, | ||
"codespaces": {} | ||
}, | ||
"hostRequirements": { | ||
"memory": "4gb" | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
"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" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "terraform" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Terraform Format Check | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
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@v44 | ||
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=$? | ||
done | ||
exit $EXIT_CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Terraform Unit Tests | ||
|
||
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: Execute Unit Tests | ||
shell: bash | ||
run: | | ||
cd ./infra | ||
terraform init -backend=false | ||
terraform test -test-directory=unit-tests | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Terraform Validation Check | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
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@v44 | ||
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 validate" | ||
cd $file | ||
terraform init -backend=false || EXIT_CODE=$? | ||
terraform validate || EXIT_CODE=$? | ||
rm -rf .terraform/ | ||
cd ${{ github.workspace }} | ||
done | ||
exit $EXIT_CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Local .terraform directories | ||
**/.terraform/* | ||
**/.terraform.lock.hcl | ||
|
||
# .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 | ||
|
||
# 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 | ||
|
||
# Ignore .env | ||
*.env |
Oops, something went wrong.