Skip to content

Commit

Permalink
2023 refactor 2
Browse files Browse the repository at this point in the history
  • Loading branch information
darkpandarts committed Oct 1, 2023
1 parent 2a5a20b commit 8b9298c
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 34 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,7 @@ dmypy.json
.pyre/
serverless/exif-ripper/*.output
append_these_perms_to_aws_credentials_file.secrets


*/**/.pluralith
*/**/.vscode
2 changes: 1 addition & 1 deletion terraform_v1/01_sls_deployment_bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | `"dev"` | no |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions terraform_v1/01_sls_deployment_bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}
2 changes: 1 addition & 1 deletion terraform_v1/02_DEV/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | `"dev"` | no |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_ssm_root_prefix"></a> [ssm\_root\_prefix](#input\_ssm\_root\_prefix) | SSM root prefix used to construct the key path | `string` | `"/stablecaps/exifripper"` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions terraform_v1/02_DEV/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}

variable "ssm_root_prefix" {
Expand Down
2 changes: 1 addition & 1 deletion terraform_v1/03_PROD/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | `"prod"` | no |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_ssm_root_prefix"></a> [ssm\_root\_prefix](#input\_ssm\_root\_prefix) | SSM root prefix used to construct the key path | `string` | `"/stablecaps/exifripper"` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions terraform_v1/03_PROD/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}

variable "ssm_root_prefix" {
Expand Down
2 changes: 1 addition & 1 deletion terraform_v1/modules/exif_ripper_buckets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ No requirements.
| <a name="input_bucket_dest"></a> [bucket\_dest](#input\_bucket\_dest) | Exif-ripper destination bucket that sanitised files are copied to | `string` | n/a | yes |
| <a name="input_bucket_source"></a> [bucket\_source](#input\_bucket\_source) | Exif-ripper source bucket that is monitored for new files | `string` | n/a | yes |
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_ssm_root_prefix"></a> [ssm\_root\_prefix](#input\_ssm\_root\_prefix) | SSM root prefix used to construct the key path | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A map that is used to apply tags to resources created by terraform | `map(string)` | n/a | yes |

Expand Down
1 change: 1 addition & 0 deletions terraform_v1/modules/exif_ripper_buckets/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}


Expand Down
6 changes: 3 additions & 3 deletions terraform_v2/00_setup_remote_s3_backend_dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ No resources.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | n/a | `string` | `"dev"` | no |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | n/a | `string` | n/a | yes |
| <a name="input_terraform_backend_config_file_path"></a> [terraform\_backend\_config\_file\_path](#input\_terraform\_backend\_config\_file\_path) | n/a | `string` | `"."` | no |
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_terraform_backend_config_file_path"></a> [terraform\_backend\_config\_file\_path](#input\_terraform\_backend\_config\_file\_path) | Path to Terraform backend config file | `string` | `"."` | no |

## Outputs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@
# be bootstrapped according to the simple yet essential procedure in
# https://github.com/cloudposse/terraform-aws-tfstate-backend#usage

variable "env" {
type = string
default = "dev"
}

variable "random_string" {
type = string
}

variable "terraform_backend_config_file_path" {
type = string
default = "."
}


module "terraform_state_backend" {

source = "cloudposse/tfstate-backend/aws"
Expand Down
16 changes: 16 additions & 0 deletions terraform_v2/00_setup_remote_s3_backend_dev/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
variable "env" {
description = "Deployment environment. e.g. dev, uat, prod"
type = string
}

variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}

variable "terraform_backend_config_file_path" {
description = "Path to Terraform backend config file"
type = string
default = "."
}
6 changes: 3 additions & 3 deletions terraform_v2/00_setup_remote_s3_backend_prod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ No resources.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | n/a | `string` | `"prod"` | no |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | n/a | `string` | n/a | yes |
| <a name="input_terraform_backend_config_file_path"></a> [terraform\_backend\_config\_file\_path](#input\_terraform\_backend\_config\_file\_path) | n/a | `string` | `"."` | no |
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_terraform_backend_config_file_path"></a> [terraform\_backend\_config\_file\_path](#input\_terraform\_backend\_config\_file\_path) | Path to Terraform backend config file | `string` | `"."` | no |

## Outputs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
# https://github.com/cloudposse/terraform-aws-tfstate-backend#usage

variable "env" {
type = string
default = "prod"
description = "Deployment environment. e.g. dev, uat, prod"
type = string
}

variable "random_string" {
type = string
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}

variable "terraform_backend_config_file_path" {
type = string
default = "."
description = "Path to Terraform backend config file"
type = string
default = "."
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_ssm_root_prefix"></a> [ssm\_root\_prefix](#input\_ssm\_root\_prefix) | SSM root prefix used to construct the key path | `string` | n/a | yes |

## Outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}

variable "ssm_root_prefix" {
Expand Down
2 changes: 1 addition & 1 deletion terraform_v2/entrypoints/sls_deployment_bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | `"dev"` | no |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |

## Outputs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}
2 changes: 1 addition & 1 deletion terraform_v2/modules/exif_ripper_buckets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ No requirements.
| <a name="input_bucket_dest"></a> [bucket\_dest](#input\_bucket\_dest) | Exif-ripper destination bucket that sanitised files are copied to | `string` | n/a | yes |
| <a name="input_bucket_source"></a> [bucket\_source](#input\_bucket\_source) | Exif-ripper source bucket that is monitored for new files | `string` | n/a | yes |
| <a name="input_env"></a> [env](#input\_env) | Deployment environment. e.g. dev, uat, prod | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | n/a | yes |
| <a name="input_random_string"></a> [random\_string](#input\_random\_string) | A random string to ensure that different people can create globally unique s3 resources | `string` | `"defaultNotRandom"` | no |
| <a name="input_ssm_root_prefix"></a> [ssm\_root\_prefix](#input\_ssm\_root\_prefix) | SSM root prefix used to construct the key path | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A map that is used to apply tags to resources created by terraform | `map(string)` | n/a | yes |

Expand Down
1 change: 1 addition & 0 deletions terraform_v2/modules/exif_ripper_buckets/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ variable "env" {
variable "random_string" {
description = "A random string to ensure that different people can create globally unique s3 resources"
type = string
default = "defaultNotRandom"
}


Expand Down
24 changes: 23 additions & 1 deletion xxx_terraform-docs.sh → xxx_terraform_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

if [ "$#" -ne 1 ]; then
echo "USAGE: ./xxx_terraform-docs.sh \${YOUR_TERRAFORM_EXEC}"
echo "e.g > ./xxx_terraform-docs.sh terraform_v1.0.6"
echo "e.g > ./xxx_terraform-docs.sh terraform_v1.5.1"
exit 0
fi

Expand All @@ -24,7 +24,29 @@ unique_tf_dirs=$(find ./ -not -path "*/\.*" -not -path "*venv/*" -not -path "*no

for tf_dirs in $unique_tf_dirs; do
cd $tf_dirs
echo ""
pwd
# TODO: customise this further to enrich READMEs and create links to them from root directory
terraform-docs markdown table --output-file README.md --output-mode inject .

IMAGE_FILE="./images/terraform_infra.png"
if [ -f "$IMAGE_FILE" ]; then
echo "Adding infra image"
### rm previous additions

sed -i "s|images/terraform_infra.png||g" README.md
mv -f README.md README.temp


MDIMG_LINK="![terraform_infra](${IMAGE_FILE})"
echo "$MDIMG_LINK" > README.md
echo "" >> README.md
echo "" >> README.md
cat README.temp >> README.md
rm README.temp

else
echo "nofindo"
fi
cd -
done

0 comments on commit 8b9298c

Please sign in to comment.