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+
5+ <!-- BEGIN_TF_DOCS -->
6+ ## Requirements
7+
8+ | Name | Version |
9+ | ------| ---------|
10+ | <a name =" requirement_terraform " ></a > [ terraform] ( #requirement\_ terraform ) | ~ > 1.3 |
11+ | <a name =" requirement_local " ></a > [ local] ( #requirement\_ local ) | ~ > 2.3.0 |
12+ | <a name =" requirement_time " ></a > [ time] ( #requirement\_ time ) | ~ > 0.9.1 |
13+
14+ ## Providers
15+
16+ | Name | Version |
17+ | ------| ---------|
18+ | <a name =" provider_local " ></a > [ local] ( #provider\_ local ) | ~ > 2.3.0 |
19+ | <a name =" provider_time " ></a > [ time] ( #provider\_ time ) | ~ > 0.9.1 |
20+
21+ ## Modules
22+
23+ No modules.
24+
25+ ## Resources
26+
27+ | Name | Type |
28+ | ------| ------|
29+ | [ local_file.main] ( https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file ) | resource |
30+ | [ time_static.last_update] ( https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static ) | resource |
31+
32+ ## Inputs
33+
34+ | Name | Description | Type | Default | Required |
35+ | ------| -------------| ------| ---------| :--------:|
36+ | <a name =" input_content " ></a > [ content] ( #input\_ content ) | content to be written in the local file | ` string ` | n/a | yes |
37+ | <a name =" input_customer " ></a > [ customer] ( #input\_ customer ) | Customer for the current deployment | ` string ` | ` "" ` | no |
38+ | <a name =" input_filename " ></a > [ filename] ( #input\_ filename ) | full filepath to be used | ` string ` | n/a | yes |
39+ | <a name =" input_name " ></a > [ name] ( #input\_ name ) | The name of the template resource | ` string ` | ` "my-template" ` | no |
40+ | <a name =" input_tags " ></a > [ tags] ( #input\_ tags ) | Default tags to add to resources | ` map(any) ` | ` {} ` | no |
41+
42+ ## Outputs
43+
44+ No outputs.
45+ <!-- 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.3.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