Skip to content

Commit 9302988

Browse files
authored
Merge pull request #36 from aws-ia/ephemeral_project-updates
Updates from project type
2 parents 862317e + a13cdc4 commit 9302988

File tree

22 files changed

+71
-174
lines changed

22 files changed

+71
-174
lines changed

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is auto-generated, changes will be overwritten
2-
_commit: v0.0.1
3-
_src_path: /task/41906a63-e3bb-11ed-90bf-1a813f494731/projecttype
2+
_commit: v0.0.6
3+
_src_path: /task/04dba63e-eac8-11ed-962f-66a115cc3c0d/projecttype
44
starting_version: v0.0.0
55
version_file: VERSION
66

.header.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
fail_fast: false
3+
minimum_pre_commit_version: "2.6.0"
4+
repos:
5+
-
6+
repo: https://github.com/terraform-docs/terraform-docs
7+
# To update run:
8+
# pre-commit autoupdate --freeze
9+
rev: 212db41760d7fc45d736d5eb94a483d0d2a12049 # frozen: v0.16.0
10+
hooks:
11+
- id: terraform-docs-go
12+
args:
13+
- "--config=.terraform-docs.yaml"
14+
- "--lockfile=false"
15+
- "--recursive"
16+
- "--recursive-path=examples/"
17+
- "./"
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#!/bin/bash -ex
1+
#!/bin/bash -e
22

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

8+
echo "Starting Funtional Tests"
9+
810
cd ${PROJECT_PATH}
911

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

26-
#********** Terratest execution **********
27-
cd ${PROJECT_PATH}
28-
echo "Building readme.md file"
29-
UPDATE_BRANCH="ephemeral_readme-updates"
30-
31-
export GH_DEBUG=1
32-
REMOTE=$(git remote -v | awk '{print $2}' | head -n 1)
33-
git remote remove origin
34-
git remote add origin ${REMOTE}
35-
git fetch --all
36-
37-
git push origin -d $UPDATE_BRANCH || true
38-
git checkout -b "$UPDATE_BRANCH"
39-
terraform-docs --lockfile=false ./
40-
41-
if [ -n "${BASE_PATH}" ]
42-
then
43-
git add . --all
44-
git commit -m "(automated) Updates from project type"
45-
git push -f --set-upstream origin $UPDATE_BRANCH
46-
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_"
47-
else
48-
echo "Local build mode (skipping git commit)"
49-
fi
28+
echo "End of Functional Tests"

.project_automation/publication/Dockerfile.rej

Lines changed: 0 additions & 8 deletions
This file was deleted.

.project_automation/publication/entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ else
1919
gh release create ${VERSION} --target ${BRANCH} --generate-notes
2020
fi
2121

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

.project_automation/publication/entrypoint.sh.rej

Lines changed: 0 additions & 6 deletions
This file was deleted.

.project_automation/static_tests/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ RUN wget -O /tmp/tflint-ruleset-aws.zip https://github.com/terraform-linters/tfl
2121
RUN curl -s https://raw.githubusercontent.com/aquasecurity/tfsec/master/scripts/install_linux.sh | bash
2222

2323
RUN gem install mdl
24+
25+
ENV TERRAFORM_DOCS_VERSION=v0.16.0
26+
RUN wget https://github.com/terraform-docs/terraform-docs/releases/download/${TERRAFORM_DOCS_VERSION}/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz && \
27+
tar -C /usr/local/bin -xzf terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz && chmod +x /usr/local/bin/terraform-docs
Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,55 @@
1-
#!/bin/bash -ex
1+
#!/bin/bash -e
22

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

8+
echo "Starting Static Tests"
9+
810
cd ${PROJECT_PATH}
911
terraform init
1012
terraform validate
1113

14+
#********** tflint ********************
15+
echo 'Starting tflint'
1216
tflint --init
13-
tflint
14-
17+
MYLINT=$(tflint --force)
18+
if [ -z "$MYLINT" ]
19+
then
20+
echo "Success - tflint found no linting issues!"
21+
else
22+
echo "Failure - tflint found linting issues!"
23+
echo "$MYLINT"
24+
exit 1
25+
fi
26+
#********** tfsec *********************
27+
# tfsec will report to the console with success or Failure
28+
# therefore there is no need to provide such conditional stetements
29+
echo 'Starting tfsec'
1530
tfsec .
16-
17-
mdl .header.md
31+
#********** Markdown Lint **************
32+
echo 'Starting markdown lint'
33+
MYMDL=$(mdl .header.md || true)
34+
if [ -z "$MYMDL" ]
35+
then
36+
echo "Success - markdown lint found no linting issues!"
37+
else
38+
echo "Failure - markdown lint found linting issues!"
39+
echo "$MYMDL"
40+
exit 1
41+
fi
42+
#********** Terraform Docs *************
43+
echo 'Starting terraform-docs'
44+
TDOCS="$(terraform-docs --lockfile=false ./)"
45+
git add -N README.md
46+
GDIFF="$(git diff --compact-summary)"
47+
if [ -z "$GDIFF" ]
48+
then
49+
echo "Success - Terraform Docs creation verified!"
50+
else
51+
echo "Failure - Terraform Docs creation failed, ensure you have precommit installed and running before submitting the Pull Request"
52+
exit 1
53+
fi
54+
#***************************************
55+
echo "End of Static Tests"

CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)