Skip to content

Commit 501c606

Browse files
authored
chore: Change examples folder, move examples section from docs yaml (#10)
* chore: Change examples folder, move examples section from docs yaml * chore: Better gitignore file
1 parent 5d5ca1e commit 501c606

10 files changed

Lines changed: 33 additions & 14 deletions

File tree

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,21 @@ crash.log
1111

1212
# terraform.lock.hcl files
1313
.terraform.lock.hcl
14+
15+
# Exclude all .tfvars files, which are likely to contain sentitive data, such as
16+
# password, private keys, and other secrets. These should not be part of version
17+
# control as they are data points which are potentially sensitive and subject
18+
# to change depending on the environment.
19+
#
20+
terraform.tfvars
21+
22+
# Ignore override files as they are usually used to override resources locally and so
23+
# are not checked in
24+
override.tf
25+
override.tf.json
26+
*_override.tf
27+
*_override.tf.json
28+
29+
# Include override files you do wish to add to version control using negated pattern
30+
#
31+
# !example_override.tf

.terraform-docs.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ sections:
77
show: [all]
88

99
content: |-
10-
## EXAMPLES
11-
```hcl
12-
{{ include "example/full-example/main.tf" }}
13-
```
14-
1510
{{ .Header }}
1611
1712
{{ .Footer }}

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,22 @@ _Brief Description of MODULE:_
3131
_Example usage of the module - terraform code snippet_
3232

3333
```terraform
34+
module "template" {
35+
source = "github.com/getindata/terraform-module-template"
36+
37+
example_var = "foo"
38+
}
3439
```
3540

3641
## NOTES
3742

3843
_Additional information that should be made public, for ex. how to solve known issues, additional descriptions/suggestions_
3944

40-
<!-- BEGIN_TF_DOCS -->
4145
## EXAMPLES
42-
```hcl
43-
module "terraform_module_template" {
44-
source = "../../"
45-
context = module.this.context
4646

47-
example_var = "This is example value."
48-
}
49-
```
47+
- [Full example](examples/full-example)
5048

49+
<!-- BEGIN_TF_DOCS -->
5150

5251

5352

locals.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
locals {
2+
# Get a name from the descriptor. If not available, use default naming convention.
3+
# Trim and replace function are used to avoid bare delimiters on both ends of the name and situation of adjacent delimiters.
4+
name_from_descriptor = trim(replace(
5+
lookup(module.this.descriptors, "module-resource-name", module.this.id), "/${module.this.delimiter}${module.this.delimiter}+/", ""
6+
), module.this.delimiter)
7+
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# echoes it's base64 encoded version locally
33

44
resource "null_resource" "output_input" {
5-
65
triggers = {
6+
name = local.name_from_descriptor
77
input = var.example_var
88
}
99

0 commit comments

Comments
 (0)