Skip to content

Commit 28ec4c5

Browse files
committed
Updating repo structure
1 parent d9bd72d commit 28ec4c5

11 files changed

+209
-151
lines changed

Diff for: .gitignore

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
build/
2-
plan.out
3-
plan.out.json
1+
.DS_Store
2+
.idea
3+
.build
4+
*.vscode
5+
6+
# mkdocs documentation
7+
/site
48

59
# Local .terraform directories
6-
.terraform/
10+
**/.terraform/*
11+
12+
# Terraform lockfile
13+
.terraform.lock.hcl
714

815
# .tfstate files
916
*.tfstate
1017
*.tfstate.*
18+
*.tfplan
1119

1220
# Crash log files
1321
crash.log
@@ -16,7 +24,6 @@ crash.log
1624
# password, private keys, and other secrets. These should not be part of version
1725
# control as they are data points which are potentially sensitive and subject
1826
# to change depending on the environment.
19-
#
2027
*.tfvars
2128

2229
# Ignore override files as they are usually used to override resources locally and so
@@ -26,19 +33,13 @@ override.tf.json
2633
*_override.tf
2734
*_override.tf.json
2835

29-
# Include override files you do wish to add to version control using negated pattern
30-
#
31-
# !example_override.tf
32-
33-
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
34-
# example: *tfplan*
35-
3636
# Ignore CLI configuration files
3737
.terraformrc
3838
terraform.rc
39-
.terraform.lock.hcl
4039

41-
go.mod
42-
go.sum
40+
# TFSec files
41+
.tfsec
4342

44-
.DS_Store
43+
# local env
44+
*.envrc
45+
*kube-config.yaml

Diff for: .header.md

+12-56
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,19 @@
1-
# Creating modules for AWS I&A Organization
1+
# Terraform Module for AWS GuardDuty
22

3-
This repo template is used to seed Terraform Module templates for the [AWS I&A GitHub organization](https://github.com/aws-ia). Usage of this template is allowed per included license. PRs to this template will be considered but are not guaranteed to be included. Consider creating an issue to discuss a feature you want to include before taking the time to create a PR.
3+
- [Terraform Module for AWS GuardDuty](#terraform-module-for-aws-guardduty)
4+
- [Overview Diagrams](#overview-diagrams)
5+
- [Stand-Alone](#stand-alone)
6+
- [Organizations](#organizations)
7+
- [Terraform Module](#terraform-module)
48

5-
<!-- markdownlint-disable MD001 -->
6-
### TL;DR
9+
## Overview Diagrams
710

8-
1. [install pre-commit](https://pre-commit.com/#install)
9-
- Prerequisites:
10-
- [Python](https://docs.python.org/3/using/index.html)
11-
- [Pip](https://pip.pypa.io/en/stable/installation/)
12-
2. configure pre-commit: `pre-commit install`
13-
3. install required tools
14-
- [tflint](https://github.com/terraform-linters/tflint)
15-
- [tfsec](https://aquasecurity.github.io/tfsec/v1.0.11/)
16-
- [terraform-docs](https://github.com/terraform-docs/terraform-docs)
17-
- [golang](https://go.dev/doc/install) (for macos you can use `brew`)
18-
- [coreutils](https://www.gnu.org/software/coreutils/)
11+
### Stand-Alone
1912

20-
Write code according to [I&A module standards](https://aws-ia.github.io/standards-terraform/)
13+
![standalone-diagram](./docs/StandaloneGuardDuty_v1.png)
2114

22-
## Module Documentation
15+
### Organizations
2316

24-
**Do not manually update README.md**. README.md is automatically generated by pulling in content from other files. For instructions, including a fill-in-the-blank content template, see [Create readmes for Terraform-based Partner Solutions.](https://aws-ia-us-west-2.s3.us-west-2.amazonaws.com/docs/content/index.html#/lessons/8rpYWWL59M7dcS-NsjYmaISUu-L_UqEv)
17+
![organizations-diagram](./docs/OrgGuardDuty_v1.png)
2518

26-
## Terratest
27-
28-
Please include tests to validate your examples/<> root modules, at a minimum. This can be accomplished with usually only slight modifications to the [boilerplate test provided in this template](./test/examples_basic_test.go)
29-
30-
### Configure and run Terratest
31-
32-
1. Install
33-
34-
[golang](https://go.dev/doc/install) (for macos you can use `brew`)
35-
2. Change directory into the test folder.
36-
37-
`cd test`
38-
3. Initialize your test
39-
40-
go mod init github.com/[github org]/[repository]
41-
42-
`go mod init github.com/aws-ia/terraform-aws-vpc`
43-
4. Run tidy
44-
45-
`go mod tidy`
46-
5. Install Terratest
47-
48-
`go get github.com/gruntwork-io/terratest/modules/terraform`
49-
6. Run test (You can have multiple test files).
50-
- Run all tests
51-
52-
`go test`
53-
- Run a specific test with a timeout
54-
55-
`go test -run TestExamplesBasic -timeout 45m`
56-
57-
## Module Standards
58-
59-
For best practices and information on developing with Terraform, see the [I&A Module Standards](https://aws-ia.github.io/standards-terraform/)
60-
61-
## Continuous Integration
62-
63-
The I&A team uses AWS CodeBuild to perform continuous integration (CI) within the organization. Our CI uses the a repo's `.pre-commit-config.yaml` file as well as some other checks. All PRs with other CI will be rejected. See our [FAQ](https://aws-ia.github.io/standards-terraform/faq/#are-modules-protected-by-ci-automation) for more details.
19+
## Terraform Module

Diff for: .pre-commit-config.yaml

+39-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
1-
---
2-
fail_fast: false
3-
minimum_pre_commit_version: "2.6.0"
41
repos:
5-
-
6-
repo: https://github.com/aws-ia/pre-commit-configs
7-
# To update run:
8-
# pre-commit autoupdate --freeze
9-
rev: 80ed3f0a164f282afaac0b6aec70e20f7e541932 # frozen: v1.5.0
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
104
hooks:
11-
- id: aws-ia-meta-hook
5+
- id: trailing-whitespace
6+
args: ['--markdown-linebreak-ext=md']
7+
- id: end-of-file-fixer
8+
- id: check-merge-conflict
9+
- id: detect-private-key
10+
- id: detect-aws-credentials
11+
args: ['--allow-missing-credentials']
12+
- repo: https://github.com/antonbabenko/pre-commit-terraform
13+
rev: v1.81.0
14+
hooks:
15+
- id: terraform_fmt
16+
- id: terraform_docs
17+
args:
18+
- '--args=--lockfile=false'
19+
- id: terraform_tflint
20+
args:
21+
- '--args=--only=terraform_deprecated_interpolation'
22+
- '--args=--only=terraform_deprecated_index'
23+
- '--args=--only=terraform_unused_declarations'
24+
- '--args=--only=terraform_comment_syntax'
25+
- '--args=--only=terraform_documented_outputs'
26+
- '--args=--only=terraform_documented_variables'
27+
- '--args=--only=terraform_typed_variables'
28+
- '--args=--only=terraform_module_pinned_source'
29+
- '--args=--only=terraform_naming_convention'
30+
- '--args=--only=terraform_required_version'
31+
- '--args=--only=terraform_required_providers'
32+
- '--args=--only=terraform_standard_module_structure'
33+
- '--args=--only=terraform_workspace_remote'
34+
- id: terraform_validate
35+
exclude: docs
36+
exclude: modules/organizations_member
37+
- id: terraform_tfsec
38+
args:
39+
- --args=--config-file=__GIT_WORKING_DIR__/.tfsec.yaml
40+
- --args=--concise-output
41+
- id: terraform_checkov

Diff for: .terraform-docs.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ settings:
66
default: true
77
escape: true
88
html: true
9-
indent: 2
9+
indent: 3
1010
required: true
1111
sensitive: true
1212
type: true
1313
lockfile: false
14+
footer: true
1415

1516
sort:
1617
enabled: true
@@ -19,3 +20,6 @@ sort:
1920
output:
2021
file: README.md
2122
mode: replace
23+
template: |-
24+
{{ .Content }}
25+
{{- printf "\n" -}}

Diff for: .tflint.hcl

-66
This file was deleted.

Diff for: .tfsec.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exclude:
2+
- aws-s3-enable-bucket-logging # TFSec is showing a false positive regarding enabling bucket logging in the tests/ directory.

Diff for: CODEOWNERS

-1
This file was deleted.

Diff for: CODE_OF_CONDUCT.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Code of Conduct
2+
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3+
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4+
[email protected] with any additional questions or comments.

Diff for: CONTRIBUTING.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing Guidelines
2+
3+
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4+
documentation, we greatly value feedback and contributions from our community.
5+
6+
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7+
information to effectively respond to your bug report or contribution.
8+
9+
## Reporting Bugs/Feature Requests
10+
11+
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
12+
13+
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
14+
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
15+
16+
- A reproducible test case or series of steps
17+
- The version of our code being used
18+
- Any modifications you've made relevant to the bug
19+
- Anything unusual about your environment or deployment
20+
21+
## Contributing via Pull Requests
22+
23+
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
24+
25+
1. You are working against the latest source on the _main_ branch.
26+
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
27+
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
28+
29+
To send us a pull request, please:
30+
31+
1. Fork the repository.
32+
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
33+
3. Ensure local tests pass.
34+
4. Commit to your fork using clear commit messages.
35+
5. Send us a pull request, answering any default questions in the pull request interface.
36+
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
37+
38+
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
39+
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
40+
41+
## Finding contributions to work on
42+
43+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
44+
45+
## Code of Conduct
46+
47+
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
48+
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
49+
[email protected] with any additional questions or comments.
50+
51+
## Security issue notifications
52+
53+
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
54+
55+
## Licensing
56+
57+
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2023 Amazon Web Services, Inc
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)