-
Notifications
You must be signed in to change notification settings - Fork 32
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
1 parent
0ea526a
commit 2959410
Showing
11 changed files
with
270 additions
and
20 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
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
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
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
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
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,69 @@ | ||
### To generate the output file to partially incorporate in the README.md, | ||
### Execute this command in the Terraform module's code folder: | ||
# terraform-docs -c .terraform-docs.yml . | ||
|
||
formatter: "markdown document" # this is required | ||
|
||
version: "0.16.0" | ||
|
||
header-from: "_header.md" | ||
|
||
recursive: | ||
enabled: false | ||
path: modules | ||
|
||
sections: | ||
hide: [] | ||
show: [] | ||
|
||
content: |- | ||
{{ .Header }} | ||
```hcl | ||
{{ include "main.tf" }} | ||
``` | ||
<!-- markdownlint-disable MD033 --> | ||
{{ .Requirements }} | ||
{{ .Providers }} | ||
{{ .Resources }} | ||
<!-- markdownlint-disable MD013 --> | ||
{{ .Inputs }} | ||
{{ .Outputs }} | ||
{{ .Modules }} | ||
{{ .Footer }} | ||
output: | ||
file: README.md | ||
mode: replace | ||
template: |- | ||
<!-- BEGIN_TF_DOCS --> | ||
{{ .Content }} | ||
<!-- END_TF_DOCS --> | ||
output-values: | ||
enabled: false | ||
from: "" | ||
|
||
sort: | ||
enabled: true | ||
by: required | ||
|
||
settings: | ||
anchor: true | ||
color: true | ||
default: true | ||
description: false | ||
escape: true | ||
hide-empty: false | ||
html: true | ||
indent: 2 | ||
lockfile: false | ||
read-comments: true | ||
required: true | ||
sensitive: true | ||
type: true |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Examples | ||
|
||
Create a directory for each example. | ||
Create a README.md file in each directory to help consumers understand the example. | ||
- Create a directory for each example. | ||
- Create a `_header.md` file in each directory to describe the example. | ||
- See the `default` example provided as a skeleton - this must remain, but you can add others. | ||
- Run `make fmt && make docs` from the repo root to generate the required documentation. | ||
|
||
> **Note:** Examples must be deployable and idempotent. Ensure that no input variables are requried to run the example and that random values are used to ensure unique resource names. E.g. use `random_pet` to generate a unique name for a resource. | ||
> **Note:** Examples must be deployable and idempotent. Ensure that no input variables are required to run the example and that random values are used to ensure unique resource names. E.g. use the [naming module](https://registry.terraform.io/modules/Azure/naming/azurerm/latest) to generate a unique name for a resource. |
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,109 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
# Default example | ||
|
||
This deploys the module in its simplest form. | ||
|
||
```hcl | ||
terraform { | ||
required_version = ">= 1.0.0" | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">= 3.7.0, < 4.0.0" | ||
} | ||
} | ||
} | ||
variable "enable_telemetry" { | ||
type = bool | ||
default = true | ||
description = <<DESCRIPTION | ||
This variable controls whether or not telemetry is enabled for the module. | ||
For more information see https://aka.ms/avm/telemetryinfo. | ||
If it is set to false, then no telemetry will be collected. | ||
DESCRIPTION | ||
} | ||
# This ensures we have unique CAF compliant names for our resources. | ||
module "naming" { | ||
source = "Azure/naming/azurerm" | ||
version = "0.3.0" | ||
} | ||
# This is required for resource modules | ||
resource "azurerm_resource_group" "this" { | ||
name = module.naming.resource_group.name_unique | ||
location = "MYLOCATION" | ||
} | ||
# This is the module call | ||
module "MYMODULE" { | ||
source = "../../" | ||
# source = "Azure/avm-<res/ptn>-<name>/azurerm" | ||
enable_telemetry = var.enable_telemetry | ||
# ... | ||
} | ||
``` | ||
|
||
<!-- markdownlint-disable MD033 --> | ||
## Requirements | ||
|
||
The following requirements are needed by this module: | ||
|
||
- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.0.0) | ||
|
||
- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 3.7.0, < 4.0.0) | ||
|
||
## Providers | ||
|
||
The following providers are used by this module: | ||
|
||
- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 3.7.0, < 4.0.0) | ||
|
||
## Resources | ||
|
||
The following resources are used by this module: | ||
|
||
- [azurerm_resource_group.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) (resource) | ||
|
||
<!-- markdownlint-disable MD013 --> | ||
## Required Inputs | ||
|
||
No required inputs. | ||
|
||
## Optional Inputs | ||
|
||
The following input variables are optional (have default values): | ||
|
||
### <a name="input_enable_telemetry"></a> [enable\_telemetry](#input\_enable\_telemetry) | ||
|
||
Description: This variable controls whether or not telemetry is enabled for the module. | ||
For more information see https://aka.ms/avm/telemetryinfo. | ||
If it is set to false, then no telemetry will be collected. | ||
|
||
Type: `bool` | ||
|
||
Default: `true` | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
|
||
## Modules | ||
|
||
The following Modules are called: | ||
|
||
### <a name="module_MYMODULE"></a> [MYMODULE](#module\_MYMODULE) | ||
|
||
Source: ../../ | ||
|
||
Version: | ||
|
||
### <a name="module_naming"></a> [naming](#module\_naming) | ||
|
||
Source: Azure/naming/azurerm | ||
|
||
Version: 0.3.0 | ||
|
||
|
||
<!-- END_TF_DOCS --> |
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,3 @@ | ||
# Default example | ||
|
||
This deploys the module in its simplest form. |
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,39 @@ | ||
terraform { | ||
required_version = ">= 1.0.0" | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">= 3.7.0, < 4.0.0" | ||
} | ||
} | ||
} | ||
|
||
variable "enable_telemetry" { | ||
type = bool | ||
default = true | ||
description = <<DESCRIPTION | ||
This variable controls whether or not telemetry is enabled for the module. | ||
For more information see https://aka.ms/avm/telemetryinfo. | ||
If it is set to false, then no telemetry will be collected. | ||
DESCRIPTION | ||
} | ||
|
||
# This ensures we have unique CAF compliant names for our resources. | ||
module "naming" { | ||
source = "Azure/naming/azurerm" | ||
version = "0.3.0" | ||
} | ||
|
||
# This is required for resource modules | ||
resource "azurerm_resource_group" "this" { | ||
name = module.naming.resource_group.name_unique | ||
location = "MYLOCATION" | ||
} | ||
|
||
# This is the module call | ||
module "MYMODULE" { | ||
source = "../../" | ||
# source = "Azure/avm-<res/ptn>-<name>/azurerm" | ||
enable_telemetry = var.enable_telemetry | ||
# ... | ||
} |
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