Skip to content

Commit

Permalink
docs: generate Terraform docs (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLicense authored Mar 11, 2024
1 parent ae24a6f commit e2ca108
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .lintstagedrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ const generateTerraformDocs = (filenames) => {

return [
...modules.map((module) => `terraform-docs markdown --output-file ${module}/README.md ${module}`),
"git add terraform/modules/**/README.md",
"git add infra/terraform/modules/**/README.md",
];
};

export default {
"*": ["prettier --ignore-unknown --write"],
"*.{tf,tfvars}": ["terraform fmt"],
"terraform/modules/**/*": generateTerraformDocs,
"infra/terraform/modules/**/*": generateTerraformDocs,
};
14 changes: 11 additions & 3 deletions infra/terraform/modules/account/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- BEGIN_TF_DOCS -->

## Requirements

No requirements.
Expand All @@ -9,17 +10,24 @@ No providers.

## Modules

No modules.
| Name | Source | Version |
| ----------------------------------------------------- | -------------------- | ------- |
| <a name="module_github"></a> [github](#module_github) | ../../modules/github | n/a |

## Resources

No resources.

## Inputs

No inputs.
| Name | Description | Type | Default | Required |
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------- | ------- | :------: |
| <a name="input_create_github_resources"></a> [create_github_resources](#input_create_github_resources) | Whether to create the GitHub resources. | `bool` | `true` | no |
| <a name="input_github_oidc_readonly_role_policies"></a> [github_oidc_readonly_role_policies](#input_github_oidc_readonly_role_policies) | The map of policies to attach to the OIDC readonly role. | `map(string)` | `{}` | no |
| <a name="input_github_oidc_role_policies"></a> [github_oidc_role_policies](#input_github_oidc_role_policies) | A map of policy names to policy ARNs to attach to the OIDC role. | `map(string)` | `{}` | no |

## Outputs

No outputs.
<!-- END_TF_DOCS -->

<!-- END_TF_DOCS -->
44 changes: 44 additions & 0 deletions infra/terraform/modules/github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- BEGIN_TF_DOCS -->

## Requirements

| Name | Version |
| ------------------------------------------------------------------------ | -------- |
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement_aws) | >= 5.0.0 |

## Providers

No providers.

## Modules

| Name | Source | Version |
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------- |
| <a name="module_iam_github_oidc_provider"></a> [iam_github_oidc_provider](#module_iam_github_oidc_provider) | terraform-aws-modules/iam/aws//modules/iam-github-oidc-provider | ~> 5.24 |
| <a name="module_iam_github_oidc_readonly_role"></a> [iam_github_oidc_readonly_role](#module_iam_github_oidc_readonly_role) | terraform-aws-modules/iam/aws//modules/iam-github-oidc-role | ~> 5.24 |
| <a name="module_iam_github_oidc_role"></a> [iam_github_oidc_role](#module_iam_github_oidc_role) | terraform-aws-modules/iam/aws//modules/iam-github-oidc-role | ~> 5.24 |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------- | ------- | :------: |
| <a name="input_create_oidc_provider"></a> [create_oidc_provider](#input_create_oidc_provider) | Whether to create an OIDC provider. | `bool` | `true` | no |
| <a name="input_create_oidc_readonly_role"></a> [create_oidc_readonly_role](#input_create_oidc_readonly_role) | Whether to create a readonly OIDC role. This is useful for pull requests. | `bool` | `true` | no |
| <a name="input_create_oidc_role"></a> [create_oidc_role](#input_create_oidc_role) | Whether to create an OIDC role. | `bool` | `true` | no |
| <a name="input_oidc_readonly_role_policies"></a> [oidc_readonly_role_policies](#input_oidc_readonly_role_policies) | The map of policies to attach to the OIDC readonly role. | `map(string)` | `{}` | no |
| <a name="input_oidc_role_permissions_boundary_arn"></a> [oidc_role_permissions_boundary_arn](#input_oidc_role_permissions_boundary_arn) | The ARN of the permissions boundary to use for the role. | `string` | `null` | no |
| <a name="input_oidc_role_policies"></a> [oidc_role_policies](#input_oidc_role_policies) | The map of policies to attach to the OIDC role. | `map(string)` | `{}` | no |
| <a name="input_repositories"></a> [repositories](#input_repositories) | The list of repositories to add to the OIDC role. | `list(string)` | n/a | yes |

## Outputs

| Name | Description |
| -------------------------------------------------------------------------- | ------------------------------- |
| <a name="output_oidc_role_arn"></a> [oidc_role_arn](#output_oidc_role_arn) | The ARN of the GitHub OIDC role |

<!-- END_TF_DOCS -->
46 changes: 46 additions & 0 deletions infra/terraform/modules/remote-state/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.6.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.6.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_dynamodb_state_lock_policy"></a> [dynamodb\_state\_lock\_policy](#module\_dynamodb\_state\_lock\_policy) | terraform-aws-modules/iam/aws//modules/iam-policy | ~> 5.28 |
| <a name="module_dynamodb_table"></a> [dynamodb\_table](#module\_dynamodb\_table) | terraform-aws-modules/dynamodb-table/aws | ~> 4.0 |
| <a name="module_s3"></a> [s3](#module\_s3) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
| <a name="module_s3_state_policy"></a> [s3\_state\_policy](#module\_s3\_state\_policy) | terraform-aws-modules/iam/aws//modules/iam-policy | ~> 5.28 |

## Resources

| Name | Type |
|------|------|
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_create_bucket"></a> [create\_bucket](#input\_create\_bucket) | Whether to create a state bucket or not. | `bool` | `true` | no |
| <a name="input_create_bucket_policy"></a> [create\_bucket\_policy](#input\_create\_bucket\_policy) | Whether to create a policy for the S3 bucket or not. | `bool` | `true` | no |
| <a name="input_create_dynamodb_policy"></a> [create\_dynamodb\_policy](#input\_create\_dynamodb\_policy) | Whether to create a policy for the DynamoDB table or not. | `bool` | `true` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | The environment in which the resources are deployed. This is used to create a unique name for the resources. | `string` | `null` | no |
| <a name="input_identifier"></a> [identifier](#input\_identifier) | The identifier of the resources. This is used to create a unique name for the resources. | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_dynamodb_state_lock_policy_arn"></a> [dynamodb\_state\_lock\_policy\_arn](#output\_dynamodb\_state\_lock\_policy\_arn) | The ARN of the IAM policy that allows DynamoDB access for state locking |
| <a name="output_s3_state_policy_arn"></a> [s3\_state\_policy\_arn](#output\_s3\_state\_policy\_arn) | The ARN of the IAM policy that allows S3 access for state locking |
<!-- END_TF_DOCS -->

0 comments on commit e2ca108

Please sign in to comment.