This repository exists to help with new terraform projects, and with automation and training. The repository is designed to create the structure- scaffold that is alway needed for a new Terraform project. Included are the basic Github Actions. To clone scaffold repository but with no .git folder.
git clone --depth=1 git@github.com:JamesWoolfenden/tf-scaffold.git scaffold
rm scaffold\.git -recurse -force
Edit your profile and add:
function scaffold {
param(
[parameter(mandatory=$true)]
[string]$name,
[string]$branch="master")
git clone --depth=1 --branch=$branch git@github.com:JamesWoolfenden/tf-scaffold.git "$name"
rm "$name\.git" -recurse -force
}
or
function scaffold {
param(
[parameter(mandatory=$true)]
[string]$name,
[string]$branch="master",
[switch]$repo=$false)
if (!(test-path .\$name))
{
git clone --depth=1 --branch=$branch git@github.com:JamesWoolfenden/tf-scaffold.git "$name"
}
else{
write-warning "Path $name already exists"
return
}
rm "$name\.git" -recurse -force
cd $name
echo "# %name" >README.md
if ($repo)
{
git init|git add -A
pre-commit install
git commit -m "Initial Draft"
}
}
Then you can use:
scaffold -name hello-world
or to start a new git repo as well:
scaffold -name hello-world -repo
To make a new project anytime you like.
git clone --depth=1 git@github.com:JamesWoolfenden/tf-scaffold.git scaffold| rm !$/.git -rf
Or you add this to your ~/.bashrc
function scaffold() {
if [ -z "$1" ]
then
name="scaffold"
else
name=$1
fi
if [ -z "$2" ]
then
branch="master"
else
branch=$2
fi
echo "git clone --depth=1 --branch $branch git@github.com:JamesWoolfenden/tf-scaffold.git $name"
git clone --depth=1 --branch $branch git@github.com:JamesWoolfenden/tf-scaffold.git $name
rm -rf $name/.git
}
Once it's in your profile, pretty straigh forward:
$ scaffold terraform-aws-generic
git clone --depth=1 git@github.com:JamesWoolfenden/tf-scaffold.git terraform-aws-generic
Cloning into 'terraform-aws-generic'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 14 (delta 0), reused 10 (delta 0), pack-reused 0
Receiving objects: 100% (14/14), done.
Has good defaults for working with Terraform
Has a standard set of pre-commit hooks for working with Terraform and AWS. You'll need to install the pre-commit framework https://pre-commit.com/#install. And after you've added all these file to your new repo, in the root of your new repository:
pre-commit install
This is an expected file for Terraform modules. I don't use it.
This is just to make like easier for you. Problematic if you are cross platform as make isn't very good/awful at that.
A standard place to return values, either to the screen or to pass back from a module.
You are always going to be using these, I have added the most basic provider for AWS.
Where all the information goes.
This is the standard file for setting your variables in. The auto keyword ensures its picked up and used by Terraform.
Contains a map variable common_tags which should be extended and used on every taggable object.
Sets the repository to be automatically dependency scanned in github.
If you leave the section below in your README.md then the pre-commit will auto update your docs.
No requirements.
No providers.
No modules.
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
common_tags | This is to help you add tags to your cloud objects | map(any) |
n/a | yes |
No outputs.