Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions outputs/local-file/.tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugin "terraform" {
enabled = true
preset = "recommended"
}
47 changes: 47 additions & 0 deletions outputs/local-file/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# local-file module

A terraform module to create local files.
Please, keep in mind that the file content will be persisted in the terraform state.
So it's not intended to pass sensitive file content.

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 2.2.3, < 3.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | ~> 0.9.1 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_local"></a> [local](#provider\_local) | >= 2.2.3, < 3.0.0 |
| <a name="provider_time"></a> [time](#provider\_time) | ~> 0.9.1 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [local_file.main](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource |
| [time_static.last_update](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_content"></a> [content](#input\_content) | content to be written in the local file | `string` | n/a | yes |
| <a name="input_customer"></a> [customer](#input\_customer) | Customer for the current deployment | `string` | `""` | no |
| <a name="input_filename"></a> [filename](#input\_filename) | full filepath to be used | `string` | n/a | yes |
| <a name="input_name"></a> [name](#input\_name) | The name of the template resource | `string` | `"my-template"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Default tags to add to resources | `map(any)` | `{}` | no |

## Outputs

No outputs.
<!-- END_TF_DOCS -->
4 changes: 4 additions & 0 deletions outputs/local-file/local-file.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "local_file" "main" {
content = var.content
filename = var.filename
}
Comment thread
fredleger marked this conversation as resolved.
14 changes: 14 additions & 0 deletions outputs/local-file/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
locals {
# tflint-ignore: terraform_unused_declarations
interpolated_tags = merge({
"Name" = var.name,
"Customer" = var.customer,
"ManagedBy" = "Terraform",
"LastModifiedAt" = time_static.last_update.rfc3339,
},
var.tags
)
}

resource "time_static" "last_update" {
}
Empty file added outputs/local-file/outputs.tf
Empty file.
13 changes: 13 additions & 0 deletions outputs/local-file/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_version = "~> 1.3"
required_providers {
local = {
source = "hashicorp/local",
version = ">= 2.2.3, < 3.0.0"
}
Comment thread
fredleger marked this conversation as resolved.
time = {
source = "hashicorp/time",
version = "~> 0.9.1"
}
}
}
28 changes: 28 additions & 0 deletions outputs/local-file/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
variable "name" {
description = "The name of the template resource"
type = string
default = "my-template"
}

variable "customer" {
description = "Customer for the current deployment"
type = string
default = ""
}

variable "tags" {
description = "Default tags to add to resources"
type = map(any)
default = {}
}

# module specific variables
variable "filename" {
type = string
description = "full filepath to be used"
}

variable "content" {
type = string
description = "content to be written in the local file"
}
Comment thread
fredleger marked this conversation as resolved.
Loading