You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:no_entry_sign: Do not edit this readme.md file. To learn how to change this content and work with this repository, refer to CONTRIBUTING.md
3
+
Use this module to integrate Terraform Cloud Run Tasks with AWS IAM Access Analyzer for policy validation.
4
4
5
-
## Readme Content
6
-
This file will contain any instructional information about this module.
5
+

6
+
7
+
## Prerequisites
8
+
9
+
To use this module you need have the following:
10
+
11
+
1. AWS account and credentials
12
+
2. Terraform Cloud with Run Task entitlement (Business subscription or higher)
13
+
14
+
## Usage
15
+
16
+
* Build and package the Lambda files
17
+
18
+
```
19
+
make all
20
+
```
21
+
22
+
* Refer to the [module_workspace](./examples/module_workspace/README.md) for steps to deploy this module in Terraform Cloud.
23
+
24
+
* After you deployed the [module_workspace](./examples/module_workspace/README.md), navigate to your Terraform Cloud organization, go to Organization Settings > Integrations > Run tasks to find the newly created Run Task.
25
+
26
+
* You can use this run task in any workspace where you have standard IAM resource policy document. Refer to the [demo_workspace](./examples/demo_workspace/README.md) for more details.
27
+
28
+
## Limitations
29
+
30
+
1. Does not provide verbose error / warning messages in Run Task console. In the future, we will explore possibility to provide verbose logging.
31
+
32
+
2. Does not support Terraform [computed resources](https://www.terraform.io/plugin/sdkv2/schemas/schema-behaviors).
33
+
34
+
For example, the tool will report no IAM policy found for the following Terraform template. The policy json string is a computed resource. The plan output doesn't contain information of IAM policy document.
35
+
36
+
```
37
+
resource "aws_s3_bucket" "b" {
38
+
bucket = "my-tf-test-bucket"
39
+
40
+
tags = {
41
+
Name = "My bucket"
42
+
Environment = "Dev"
43
+
}
44
+
}
45
+
46
+
resource "aws_iam_policy" "policy" {
47
+
name = "test-policy"
48
+
description = "A test policy"
49
+
50
+
policy = jsonencode({
51
+
Version = "2012-10-17"
52
+
Statement = [
53
+
{
54
+
Action = [
55
+
"s3:GetObject",
56
+
]
57
+
Effect = "Allow"
58
+
Resource = "${aws_s3_bucket.b.id}"
59
+
}
60
+
]
61
+
})
62
+
}
63
+
```
64
+
65
+
## Best practice
66
+
67
+
***Do not** re-use the Run Tasks URL across different trust-boundary (organizations, accounts, team). We recommend you to deploy separate Run Task deployment per trust-boundary.
68
+
69
+
***Do not** use Run Tasks URL from untrusted party, remember that Run Tasks execution sent Terraform plan output to the Run Task endpoint. Only use trusted Run Tasks URL.
70
+
71
+
* Enable the AWS WAF setup by setting variable `deploy_waf` to `true` (additional cost will apply). This will add WAF protection to the Run Tasks URL endpoint.
72
+
73
+
* We recommend you to setup additional CloudWatch alarm to monitor Lambda concurrency and WAF rules.
terraform plan -out tf.plan -var-file .project_automation/functional_tests/functional_test.tfvars
14
28
terraform show -json tf.plan > tf.json
15
29
checkov
16
30
17
31
#********** Terratest execution **********
18
32
echo"Running Terratest"
33
+
export GOPROXY=https://goproxy.io,direct
19
34
cdtest
20
35
rm -f go.mod
21
36
go mod init github.com/aws-ia/terraform-project-ephemeral
22
37
go mod tidy
23
38
go install github.com/gruntwork-io/terratest/modules/terraform
24
39
go test -timeout 45m
25
40
26
-
#********** Terratest execution **********
41
+
#********** CLEANUP *************
42
+
echo"Cleaning up all temp files and artifacts"
27
43
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_"
Copy file name to clipboardExpand all lines: .project_automation/static_tests/Dockerfile
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,3 +21,7 @@ RUN wget -O /tmp/tflint-ruleset-aws.zip https://github.com/terraform-linters/tfl
21
21
RUN curl -s https://raw.githubusercontent.com/aquasecurity/tfsec/master/scripts/install_linux.sh | bash
22
22
23
23
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
Copy file name to clipboardExpand all lines: NOTICE.txt
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,3 +5,10 @@ Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5
5
http://aws.amazon.com/apache2.0/
6
6
7
7
or in the "license" file accompanying this file. This file 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.
8
+
9
+
**********************
10
+
THIRD PARTY COMPONENTS
11
+
**********************
12
+
This software includes third party software subject to the following copyrights:
13
+
14
+
@yaml/pyyaml under the Massachusetts Institute of Technology (MIT) license
0 commit comments