diff --git a/.github/workflows/check_terraform_fmt.yml b/.github/workflows/check_terraform_fmt.yml new file mode 100644 index 0000000..2dc1e26 --- /dev/null +++ b/.github/workflows/check_terraform_fmt.yml @@ -0,0 +1,34 @@ +--- + +# Copyright 2024 Cloudera, Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Check Terraform Formatting + +on: + pull_request: + push: + branches: [main] + +jobs: + check-tf-fmt: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Validate with terraform fmt + uses: pre-commit/action@v3.0.0 + with: + extra_args: terraform_fmt --all-files \ No newline at end of file diff --git a/.github/workflows/check_tflint.yml b/.github/workflows/check_tflint.yml new file mode 100644 index 0000000..fbd873b --- /dev/null +++ b/.github/workflows/check_tflint.yml @@ -0,0 +1,38 @@ +--- + +# Copyright 2024 Cloudera, Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Run Terraform Lint + +on: + pull_request: + push: + branches: [main] + +jobs: + check-tf-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install the tflint utility + run: | + curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash + + - name: Validate with tflint + uses: pre-commit/action@v3.0.0 + with: + extra_args: terraform_tflint --all-files \ No newline at end of file diff --git a/.github/workflows/push-quickstart-script-to-s3.yml b/.github/workflows/push-quickstart-script-to-s3.yml new file mode 100644 index 0000000..41b4dbb --- /dev/null +++ b/.github/workflows/push-quickstart-script-to-s3.yml @@ -0,0 +1,62 @@ +--- + +# Copyright 2024 Cloudera, Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Push quickstart scripts to S3 +on: + push: + branches: + - eob-devel + tags: + - eob +jobs: + push-to-s3: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set location to push + id: s3-path + run: | + if [[ $GITHUB_REF_NAME == "eob" && $GITHUB_REF_TYPE == "tag" ]]; then + echo "TRIGGER=eob-tag" >> $GITHUB_ENV + echo "S3_FOLDER=latest" >> $GITHUB_ENV + fi + + if [[ $GITHUB_REF_NAME == "eob-devel" && $GITHUB_REF_TYPE == "branch" ]]; then + echo "TRIGGER=eob-devel-branch" >> $GITHUB_ENV + echo "S3_FOLDER=dev" >> $GITHUB_ENV + fi + + - name: Print the path + run: | + echo "Trigger is ${{ env.TRIGGER }}" + echo "S3 Bucket is ${{ vars.S3_BUCKET }}" + echo "S3 Path format is s3://${{ vars.S3_BUCKET }}//${{ env.S3_FOLDER }}" + + - name: Authenticate with AWS + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Push quickstart scripts to S3 + run: | + for csp in aws azure gcp + do + aws s3 cp ${csp}/quickstart.sh s3://${{ vars.S3_BUCKET }}/${csp}/${{ env.S3_FOLDER }}/ + done \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..480e6eb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,47 @@ +# Copyright 2023 Cloudera, Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +repos: +- repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.77.3 + hooks: + # see https://github.com/antonbabenko/pre-commit-terraform#terraform_fmt + - id: terraform_fmt + args: + - --args=-diff + + # see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate + - id: terraform_validate + exclude: examples/.* + + # see https://github.com/antonbabenko/pre-commit-terraform#terraform_providers_lock + - id: terraform_providers_lock + + # see https://github.com/antonbabenko/pre-commit-terraform#terraform_tflint + - id: terraform_tflint + exclude: 'examples/.*' + args: + - '--args=--only=terraform_deprecated_interpolation' + - '--args=--only=terraform_deprecated_index' + - '--args=--only=terraform_unused_declarations' + - '--args=--only=terraform_comment_syntax' + - '--args=--only=terraform_documented_outputs' + - '--args=--only=terraform_documented_variables' + - '--args=--only=terraform_typed_variables' + - '--args=--only=terraform_module_pinned_source' + - '--args=--only=terraform_naming_convention' + - '--args=--only=terraform_required_version' + - '--args=--only=terraform_required_providers' + - '--args=--only=terraform_standard_module_structure' + - '--args=--only=terraform_workspace_remote'