File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ plugin "terraform" {
2+ enabled = true
3+ preset = " recommended"
4+ }
Original file line number Diff line number Diff line change 1+ # local-file module
2+
3+ A terraform module to create local files.
4+ Please, keep in mind that the file content will be persisted in the terraform state.
5+ So it's not intended to pass sensitive file content.
6+
7+ <!-- BEGIN_TF_DOCS -->
8+ ## Requirements
9+
10+ | Name | Version |
11+ | ------| ---------|
12+ | <a name =" requirement_terraform " ></a > [ terraform] ( #requirement\_ terraform ) | ~ > 1.3 |
13+ | <a name =" requirement_local " ></a > [ local] ( #requirement\_ local ) | >= 2.2.3, < 3.0.0 |
14+ | <a name =" requirement_time " ></a > [ time] ( #requirement\_ time ) | ~ > 0.9.1 |
15+
16+ ## Providers
17+
18+ | Name | Version |
19+ | ------| ---------|
20+ | <a name =" provider_local " ></a > [ local] ( #provider\_ local ) | >= 2.2.3, < 3.0.0 |
21+ | <a name =" provider_time " ></a > [ time] ( #provider\_ time ) | ~ > 0.9.1 |
22+
23+ ## Modules
24+
25+ No modules.
26+
27+ ## Resources
28+
29+ | Name | Type |
30+ | ------| ------|
31+ | [ local_file.main] ( https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file ) | resource |
32+ | [ time_static.last_update] ( https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static ) | resource |
33+
34+ ## Inputs
35+
36+ | Name | Description | Type | Default | Required |
37+ | ------| -------------| ------| ---------| :--------:|
38+ | <a name =" input_content " ></a > [ content] ( #input\_ content ) | content to be written in the local file | ` string ` | n/a | yes |
39+ | <a name =" input_customer " ></a > [ customer] ( #input\_ customer ) | Customer for the current deployment | ` string ` | ` "" ` | no |
40+ | <a name =" input_filename " ></a > [ filename] ( #input\_ filename ) | full filepath to be used | ` string ` | n/a | yes |
41+ | <a name =" input_name " ></a > [ name] ( #input\_ name ) | The name of the template resource | ` string ` | ` "my-template" ` | no |
42+ | <a name =" input_tags " ></a > [ tags] ( #input\_ tags ) | Default tags to add to resources | ` map(any) ` | ` {} ` | no |
43+
44+ ## Outputs
45+
46+ No outputs.
47+ <!-- END_TF_DOCS -->
Original file line number Diff line number Diff line change 1+ resource "local_file" "main" {
2+ content = var. content
3+ filename = var. filename
4+ }
Original file line number Diff line number Diff line change 1+ locals {
2+ # tflint-ignore: terraform_unused_declarations
3+ interpolated_tags = merge ({
4+ " Name" = var.name,
5+ " Customer" = var.customer,
6+ " ManagedBy" = " Terraform" ,
7+ " LastModifiedAt" = time_static.last_update.rfc3339,
8+ },
9+ var. tags
10+ )
11+ }
12+
13+ resource "time_static" "last_update" {
14+ }
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_version = " ~> 1.3"
3+ required_providers {
4+ local = {
5+ source = " hashicorp/local" ,
6+ version = " >= 2.2.3, < 3.0.0"
7+ }
8+ time = {
9+ source = " hashicorp/time" ,
10+ version = " ~> 0.9.1"
11+ }
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ variable "name" {
2+ description = " The name of the template resource"
3+ type = string
4+ default = " my-template"
5+ }
6+
7+ variable "customer" {
8+ description = " Customer for the current deployment"
9+ type = string
10+ default = " "
11+ }
12+
13+ variable "tags" {
14+ description = " Default tags to add to resources"
15+ type = map (any )
16+ default = {}
17+ }
18+
19+ # module specific variables
20+ variable "filename" {
21+ type = string
22+ description = " full filepath to be used"
23+ }
24+
25+ variable "content" {
26+ type = string
27+ description = " content to be written in the local file"
28+ }
You can’t perform that action at this time.
0 commit comments