-
Notifications
You must be signed in to change notification settings - Fork 1
feat(outputs): add local file #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| plugin "terraform" { | ||
| enabled = true | ||
| preset = "recommended" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| resource "local_file" "main" { | ||
| content = var.content | ||
| filename = var.filename | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
|
fredleger marked this conversation as resolved.
|
||
| time = { | ||
| source = "hashicorp/time", | ||
| version = "~> 0.9.1" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
|
fredleger marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.