Initial commit

This commit is contained in:
2024-02-19 19:12:32 +00:00
commit 163879aaca
7 changed files with 308 additions and 0 deletions

65
.terraform-docs.yml Normal file
View File

@@ -0,0 +1,65 @@
---
formatter: "markdown table"
version: "0.16"
header-from: ./docs/header.md
sections:
show:
- data-sources
- header
- footer
- inputs
- modules
- outputs
- providers
- requirements
- resources
content: |-
{{ .Header }}
{{ .Requirements }}
{{ .Providers }}
{{ .Modules }}
## Usage
Basic usage of this module is as follows:
```hcl
module "example" {
{{"\t"}} source = "<module-path>"
{{- if .Module.RequiredInputs }}
{{"\n\t"}} # Required variables
{{- range .Module.RequiredInputs }}
{{"\t"}} {{ .Name }} = {{ .GetValue }}
{{- end }}
{{- end }}
{{- if .Module.OptionalInputs }}
{{"\n\t"}} # Optional variables
{{- range .Module.OptionalInputs }}
{{"\t"}} {{ .Name }} = {{ .GetValue | printf "%s" }}
{{- end }}
{{- end }}
}
```
{{ .Resources }}
{{ .Inputs }}
{{ .Outputs }}
output:
file: README.md
mode: inject
template: |-
<!-- BEGIN_AUTOMATED_TF_DOCS_BLOCK -->
{{ .Content }}
<!-- END_AUTOMATED_TF_DOCS_BLOCK -->
sort:
enabled: true
by: name
settings:
anchor: true
color: true
default: true
description: true
escape: false
hide-empty: false
html: true
indent: 2
lockfile: true
required: true
sensitive: true
type: true

84
README.md Normal file
View File

@@ -0,0 +1,84 @@
<!-- BEGIN_AUTOMATED_TF_DOCS_BLOCK -->
Terraform NAME Module
========================
## Overview
Description of what the module does
## Requirements
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | >= 1.0 |
## Providers
No providers.
## Modules
| Name | Source | Version |
|------|--------|---------|
| <a name="module_default_label"></a> [default_label](#module_default_label) | git@gitlab.com:zulunity/terraform/modules/general/label.git | 0.0.0 |
## Usage
Basic usage of this module is as follows:
```hcl
module "example" {
source = "<module-path>"
# Optional variables
account = null
attributes = []
cloud_provider = null
context = {
"account": null,
"additional_tag_map": {},
"attributes": [],
"cloud_provider": null,
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"region": null,
"stage": null,
"tags": {}
}
domain = null
enabled = true
environment = null
name = "hi"
namespace = null
region = null
stage = null
tags = {}
}
```
## Resources
No resources.
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account"></a> [account](#input_account) | Name of the account being used (master, nonprod, prod, etc) | `string` | `null` | no |
| <a name="input_attributes"></a> [attributes](#input_attributes) | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| <a name="input_cloud_provider"></a> [cloud_provider](#input_cloud_provider) | Cloud provider name if any | `string` | `null` | no |
| <a name="input_context"></a> [context](#input_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional_tag_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> cloud_provider = string<br> account = string<br> region = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "account": null,<br> "additional_tag_map": {},<br> "attributes": [],<br> "cloud_provider": null,<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "region": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
| <a name="input_domain"></a> [domain](#input_domain) | TLD to use when deploying assets | `string` | `null` | no |
| <a name="input_enabled"></a> [enabled](#input_enabled) | Set to false to prevent the module from creating any resources | `bool` | `true` | no |
| <a name="input_environment"></a> [environment](#input_environment) | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `null` | no |
| <a name="input_name"></a> [name](#input_name) | Module name, e.g. 'app' or 'jenkins' | `string` | `"hi"` | no |
| <a name="input_namespace"></a> [namespace](#input_namespace) | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
| <a name="input_region"></a> [region](#input_region) | AWS region to deploy asset into | `string` | `null` | no |
| <a name="input_stage"></a> [stage](#input_stage) | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input_tags) | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
## Outputs
| Name | Description |
|------|-------------|
| <a name="output_context"></a> [context](#output_context) | Default label context |
| <a name="output_enabled"></a> [enabled](#output_enabled) | Whether or not the module is enabled |
| <a name="output_name"></a> [name](#output_name) | Name of the asset |
<!-- END_AUTOMATED_TF_DOCS_BLOCK -->

6
docs/header.md Normal file
View File

@@ -0,0 +1,6 @@
Terraform NAME Module
========================
## Overview
Description of what the module does

11
main.tf Normal file
View File

@@ -0,0 +1,11 @@
# Local
locals {
tags = {}
}
# Label
module "default_label" {
source = "git@gitlab.com:zulunity/terraform/modules/general/label.git?ref=0.0.0"
name = var.name
tags = merge(var.tags, local.tags)
}

17
outputs.tf Normal file
View File

@@ -0,0 +1,17 @@
# Standard Outputs
output "name" {
description = "Name of the asset"
value = module.default_label.id
}
output "context" {
description = "Default label context"
value = module.default_label.context
}
output "enabled" {
description = "Whether or not the module is enabled"
value = var.enabled
}
# Module Outputs

122
variables.tf Normal file
View File

@@ -0,0 +1,122 @@
###
# Standard Variables
#
# All modules expect these variables to be defined. Omitting them will result in errors or undefined/undesirable behavior.
#
# tflint-ignore: terraform_unused_declarations
variable "account" {
type = string
default = null
description = "Name of the account being used (master, nonprod, prod, etc)"
}
# tflint-ignore: terraform_unused_declarations
variable "attributes" {
type = list(string)
default = []
description = "Additional attributes (e.g. `1`)"
}
# tflint-ignore: terraform_unused_declarations
variable "cloud_provider" {
type = string
default = null
description = "Cloud provider name if any"
}
# tflint-ignore: terraform_unused_declarations
variable "context" {
type = object({
enabled = bool
namespace = string
cloud_provider = string
account = string
region = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
})
default = {
enabled = true
namespace = null
cloud_provider = null
account = null
region = null
environment = null
stage = null
name = null
delimiter = null
attributes = []
tags = {}
additional_tag_map = {}
regex_replace_chars = null
label_order = []
id_length_limit = null
}
description = <<-EOT
Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional_tag_map, which are merged.
EOT
}
# tflint-ignore: terraform_unused_declarations
variable "domain" {
type = string
default = null
description = "TLD to use when deploying assets"
}
# tflint-ignore: terraform_unused_declarations
variable "enabled" {
type = bool
default = true
description = "Set to false to prevent the module from creating any resources"
}
# tflint-ignore: terraform_unused_declarations
variable "environment" {
type = string
default = null
description = "Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT'"
}
variable "name" {
type = string
default = "hi"
description = "Module name, e.g. 'app' or 'jenkins'"
}
# tflint-ignore: terraform_unused_declarations
variable "namespace" {
type = string
default = null
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
}
# tflint-ignore: terraform_unused_declarations
variable "region" {
type = string
default = null
description = "AWS region to deploy asset into"
}
# tflint-ignore: terraform_unused_declarations
variable "stage" {
type = string
default = null
description = "Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release'"
}
# tflint-ignore: terraform_unused_declarations
variable "tags" {
type = map(string)
default = {}
description = "Additional tags (e.g. `map('BusinessUnit','XYZ')`"
}
###
# Module Variables
#
# Variables specific to this module
#

3
versions.tf Normal file
View File

@@ -0,0 +1,3 @@
terraform {
required_version = ">= 1.0"
}