Skip to content

Commit

Permalink
Merge pull request #36 from aws-ia/ephemeral_project-updates
Browse files Browse the repository at this point in the history
Updates from project type
  • Loading branch information
tbulding authored May 5, 2023
2 parents 862317e + a13cdc4 commit 9302988
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 174 deletions.
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is auto-generated, changes will be overwritten
_commit: v0.0.1
_src_path: /task/41906a63-e3bb-11ed-90bf-1a813f494731/projecttype
_commit: v0.0.6
_src_path: /task/04dba63e-eac8-11ed-962f-66a115cc3c0d/projecttype
starting_version: v0.0.0
version_file: VERSION

6 changes: 0 additions & 6 deletions .header.md

This file was deleted.

17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
fail_fast: false
minimum_pre_commit_version: "2.6.0"
repos:
-
repo: https://github.com/terraform-docs/terraform-docs
# To update run:
# pre-commit autoupdate --freeze
rev: 212db41760d7fc45d736d5eb94a483d0d2a12049 # frozen: v0.16.0
hooks:
- id: terraform-docs-go
args:
- "--config=.terraform-docs.yaml"
- "--lockfile=false"
- "--recursive"
- "--recursive-path=examples/"
- "./"
29 changes: 4 additions & 25 deletions .project_automation/functional_tests/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash -ex
#!/bin/bash -e

## NOTE: paths may differ when running in a managed task. To ensure behavior is consistent between
# managed and local tasks always use these variables for the project and project type path
PROJECT_PATH=${BASE_PATH}/project
PROJECT_TYPE_PATH=${BASE_PATH}/projecttype

echo "Starting Funtional Tests"

cd ${PROJECT_PATH}

#********** Checkov Analysis *************
Expand All @@ -23,27 +25,4 @@ go mod tidy
go install github.com/gruntwork-io/terratest/modules/terraform
go test -timeout 45m

#********** Terratest execution **********
cd ${PROJECT_PATH}
echo "Building readme.md file"
UPDATE_BRANCH="ephemeral_readme-updates"

export GH_DEBUG=1
REMOTE=$(git remote -v | awk '{print $2}' | head -n 1)
git remote remove origin
git remote add origin ${REMOTE}
git fetch --all

git push origin -d $UPDATE_BRANCH || true
git checkout -b "$UPDATE_BRANCH"
terraform-docs --lockfile=false ./

if [ -n "${BASE_PATH}" ]
then
git add . --all
git commit -m "(automated) Updates from project type"
git push -f --set-upstream origin $UPDATE_BRANCH
gh pr create --title "Updates from functional tests " --body "_This is an automated PR incorporating updates to this project's readme.md file. Please review and either approve/merge or reject as appropriate_"
else
echo "Local build mode (skipping git commit)"
fi
echo "End of Functional Tests"
8 changes: 0 additions & 8 deletions .project_automation/publication/Dockerfile.rej

This file was deleted.

3 changes: 1 addition & 2 deletions .project_automation/publication/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ else
gh release create ${VERSION} --target ${BRANCH} --generate-notes
fi

aws sts get-caller-identity
aws s3 ls s3://ia-prj-cfg-versions/

6 changes: 0 additions & 6 deletions .project_automation/publication/entrypoint.sh.rej

This file was deleted.

4 changes: 4 additions & 0 deletions .project_automation/static_tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ RUN wget -O /tmp/tflint-ruleset-aws.zip https://github.com/terraform-linters/tfl
RUN curl -s https://raw.githubusercontent.com/aquasecurity/tfsec/master/scripts/install_linux.sh | bash

RUN gem install mdl

ENV TERRAFORM_DOCS_VERSION=v0.16.0
RUN wget https://github.com/terraform-docs/terraform-docs/releases/download/${TERRAFORM_DOCS_VERSION}/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz && \
tar -C /usr/local/bin -xzf terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz && chmod +x /usr/local/bin/terraform-docs
48 changes: 43 additions & 5 deletions .project_automation/static_tests/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,55 @@
#!/bin/bash -ex
#!/bin/bash -e

## NOTE: paths may differ when running in a managed task. To ensure behavior is consistent between
# managed and local tasks always use these variables for the project and project type path
PROJECT_PATH=${BASE_PATH}/project
PROJECT_TYPE_PATH=${BASE_PATH}/projecttype

echo "Starting Static Tests"

cd ${PROJECT_PATH}
terraform init
terraform validate

#********** tflint ********************
echo 'Starting tflint'
tflint --init
tflint

MYLINT=$(tflint --force)
if [ -z "$MYLINT" ]
then
echo "Success - tflint found no linting issues!"
else
echo "Failure - tflint found linting issues!"
echo "$MYLINT"
exit 1
fi
#********** tfsec *********************
# tfsec will report to the console with success or Failure
# therefore there is no need to provide such conditional stetements
echo 'Starting tfsec'
tfsec .

mdl .header.md
#********** Markdown Lint **************
echo 'Starting markdown lint'
MYMDL=$(mdl .header.md || true)
if [ -z "$MYMDL" ]
then
echo "Success - markdown lint found no linting issues!"
else
echo "Failure - markdown lint found linting issues!"
echo "$MYMDL"
exit 1
fi
#********** Terraform Docs *************
echo 'Starting terraform-docs'
TDOCS="$(terraform-docs --lockfile=false ./)"
git add -N README.md
GDIFF="$(git diff --compact-summary)"
if [ -z "$GDIFF" ]
then
echo "Success - Terraform Docs creation verified!"
else
echo "Failure - Terraform Docs creation failed, ensure you have precommit installed and running before submitting the Pull Request"
exit 1
fi
#***************************************
echo "End of Static Tests"
1 change: 0 additions & 1 deletion CODEOWNERS

This file was deleted.

30 changes: 0 additions & 30 deletions README.md

This file was deleted.

Empty file removed examples/basic/.header.md
Empty file.
29 changes: 0 additions & 29 deletions examples/basic/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions examples/basic/main.tf

This file was deleted.

Empty file removed examples/basic/outputs.tf
Empty file.
21 changes: 0 additions & 21 deletions examples/basic/providers.tf

This file was deleted.

Empty file removed examples/basic/variables.tf
Empty file.
Empty file removed main.tf
Empty file.
Empty file removed outputs.tf
Empty file.
13 changes: 0 additions & 13 deletions providers.tf

This file was deleted.

21 changes: 0 additions & 21 deletions test/examples_basic_test.go

This file was deleted.

Empty file removed variables.tf
Empty file.

0 comments on commit 9302988

Please sign in to comment.