-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3061cf3
Showing
8 changed files
with
405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
### Terraform ### | ||
.terraform.lock.hcl | ||
backend.tf | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sentitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
# | ||
*.tfvars | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Learn Terraform - Use Control Tower Account Factory for Terraform | ||
|
||
This is a companion repository for the [Provision and Manage Accounts with | ||
Control Tower Account Factory for Terraform | ||
tutorial](https://learn.hashicorp.com/tutorials/terraform/aws-control-tower-aft) | ||
tutorial on HashiCorp Learn. | ||
|
||
This repository contains boilerplate configuration for defining account | ||
requests to use with the Account Factory for Terraform module. THe AFT pipeline | ||
requires the structure used and the included submodule to define a DynamoDB | ||
table item with your account specifications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Auto generated providers.tf ## | ||
## Updated on: {{ timestamp }} ## | ||
|
||
provider "aws" { | ||
region = "{{ provider_region }}" | ||
assume_role { | ||
role_arn = "{{ aft_admin_role_arn }}" | ||
} | ||
default_tags { | ||
tags = { | ||
managed_by = "AFT" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Auto generated backend.tf ## | ||
## Updated on: {{ timestamp }} ## | ||
|
||
{% if tf_distribution_type == "oss" -%} | ||
terraform { | ||
required_version = ">= 0.15.0" | ||
backend "s3" { | ||
region = "{{ region }}" | ||
bucket = "{{ bucket }}" | ||
key = "{{ key }}" | ||
dynamodb_table = "{{ dynamodb_table }}" | ||
encrypt = "true" | ||
kms_key_id = "{{ kms_key_id }}" | ||
role_arn = "{{ aft_admin_role_arn }}" | ||
} | ||
} | ||
{% else -%} | ||
terraform { | ||
backend "remote" { | ||
organization = "{{ terraform_org_name }}" | ||
workspaces { | ||
name = "{{ terraform_workspace_name }}" | ||
} | ||
} | ||
} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module "sandbox" { | ||
source = "./modules/aft-account-request" | ||
|
||
control_tower_parameters = { | ||
AccountEmail = "<ACCOUNT EMAIL>" | ||
AccountName = "sandbox-aft" | ||
ManagedOrganizationalUnit = "Learn AFT" | ||
SSOUserEmail = "<SSO EMAIL>" | ||
SSOUserFirstName = "Sandbox" | ||
SSOUserLastName = "AFT" | ||
} | ||
|
||
account_tags = { | ||
"Learn Tutorial" = "AFT" | ||
} | ||
|
||
change_management_parameters = { | ||
change_requested_by = "HashiCorp Learn" | ||
change_reason = "Learn AWS Control Tower Account Factory for Terraform" | ||
} | ||
|
||
custom_fields = { | ||
group = "non-prod" | ||
} | ||
|
||
account_customizations_name = "sandbox" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
resource "aws_dynamodb_table_item" "account-request" { | ||
table_name = var.account-request-table | ||
hash_key = var.account-request-table-hash | ||
|
||
item = jsonencode({ | ||
id = { S = lookup(var.control_tower_parameters, "AccountEmail") } | ||
control_tower_parameters = { M = { | ||
AccountEmail = { S = lookup(var.control_tower_parameters, "AccountEmail") } | ||
AccountName = { S = lookup(var.control_tower_parameters, "AccountName") } | ||
ManagedOrganizationalUnit = { S = lookup(var.control_tower_parameters, "ManagedOrganizationalUnit") } | ||
SSOUserEmail = { S = lookup(var.control_tower_parameters, "SSOUserEmail") } | ||
SSOUserFirstName = { S = lookup(var.control_tower_parameters, "SSOUserFirstName") } | ||
SSOUserLastName = { S = lookup(var.control_tower_parameters, "SSOUserLastName") } | ||
} | ||
} | ||
change_management_parameters = { M = { | ||
change_reason = { S = lookup(var.change_management_parameters, "change_reason") } | ||
change_requested_by = { S = lookup(var.change_management_parameters, "change_requested_by") } | ||
} | ||
} | ||
account_tags = { S = jsonencode(var.account_tags) } | ||
account_customizations_name = { S = var.account_customizations_name } | ||
custom_fields = { S = jsonencode(var.custom_fields) } | ||
}) | ||
} |
Oops, something went wrong.