Skip to content

Commit

Permalink
chore: Change examples folder, move examples section from docs yaml (#10
Browse files Browse the repository at this point in the history
)

* chore: Change examples folder, move examples section from docs yaml

* chore: Better gitignore file
  • Loading branch information
jakubigla authored Nov 10, 2022
1 parent 5d5ca1e commit 501c606
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 14 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,21 @@ crash.log

# terraform.lock.hcl files
.terraform.lock.hcl

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
terraform.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf
5 changes: 0 additions & 5 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ sections:
show: [all]

content: |-
## EXAMPLES
```hcl
{{ include "example/full-example/main.tf" }}
```
{{ .Header }}
{{ .Footer }}
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,22 @@ _Brief Description of MODULE:_
_Example usage of the module - terraform code snippet_

```terraform
module "template" {
source = "github.com/getindata/terraform-module-template"
example_var = "foo"
}
```

## NOTES

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

<!-- BEGIN_TF_DOCS -->
## EXAMPLES
```hcl
module "terraform_module_template" {
source = "../../"
context = module.this.context

example_var = "This is example value."
}
```
- [Full example](examples/full-example)

<!-- BEGIN_TF_DOCS -->



Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
locals {
# Get a name from the descriptor. If not available, use default naming convention.
# Trim and replace function are used to avoid bare delimiters on both ends of the name and situation of adjacent delimiters.
name_from_descriptor = trim(replace(
lookup(module.this.descriptors, "module-resource-name", module.this.id), "/${module.this.delimiter}${module.this.delimiter}+/", ""
), module.this.delimiter)
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# echoes it's base64 encoded version locally

resource "null_resource" "output_input" {

triggers = {
name = local.name_from_descriptor
input = var.example_var
}

Expand Down

0 comments on commit 501c606

Please sign in to comment.