-
Notifications
You must be signed in to change notification settings - Fork 1
feat(helm): add helm template support #108
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 @@ | ||
| terraform 1.3.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,58 @@ | ||
| # helm template | ||
|
|
||
| Generates kubernetes YAML manifests through helm | ||
|
|
||
| <!-- BEGIN_TF_DOCS --> | ||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 | | ||
| | <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.17.0, < 3.0.0 | | ||
| | <a name="requirement_time"></a> [time](#requirement\_time) | ~> 0.9.1 | | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_helm"></a> [helm](#provider\_helm) | >= 2.17.0, < 3.0.0 | | ||
| | <a name="provider_time"></a> [time](#provider\_time) | ~> 0.9.1 | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [time_static.last_update](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static) | resource | | ||
| | [helm_template.main](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/data-sources/template) | data source | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_atomic"></a> [atomic](#input\_atomic) | Atomic deployment | `bool` | `false` | no | | ||
| | <a name="input_chart"></a> [chart](#input\_chart) | Chart to use for the current deployment | `string` | `""` | no | | ||
| | <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Version of the chart to use for the current deployment | `string` | `""` | no | | ||
| | <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Create namespace | `bool` | `true` | no | | ||
| | <a name="input_customer"></a> [customer](#input\_customer) | Customer for the current deployment | `string` | `""` | no | | ||
| | <a name="input_kubeconfig_context"></a> [kubeconfig\_context](#input\_kubeconfig\_context) | Kubeconfig context to use for the current deployment | `string` | `null` | no | | ||
| | <a name="input_kubeconfig_paths"></a> [kubeconfig\_paths](#input\_kubeconfig\_paths) | List of kubeconfig paths to use for the current deployment | `list(string)` | `[]` | no | | ||
| | <a name="input_name"></a> [name](#input\_name) | The name of the helm release | `string` | n/a | yes | | ||
| | <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace to use for the current deployment | `string` | `""` | no | | ||
| | <a name="input_repository"></a> [repository](#input\_repository) | Repository to use for the current deployment | `string` | `""` | no | | ||
| | <a name="input_sets"></a> [sets](#input\_sets) | List of sets to use for the current deployment | `list(map(string))` | `[]` | no | | ||
| | <a name="input_tags"></a> [tags](#input\_tags) | Default tags to add to resources | `map(any)` | `{}` | no | | ||
| | <a name="input_values"></a> [values](#input\_values) | List of values to use for the current deployment | `list(string)` | `[]` | no | | ||
| | <a name="input_wait"></a> [wait](#input\_wait) | Wait for deployment to complete | `bool` | `true` | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_manifest"></a> [manifest](#output\_manifest) | Rendered Kubernetes manifests generated by Helm | | ||
| | <a name="output_name"></a> [name](#output\_name) | The name of the helm release | | ||
| | <a name="output_namespace"></a> [namespace](#output\_namespace) | The namespace of the helm release | | ||
| <!-- 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,21 @@ | ||
| data "helm_template" "main" { | ||
| name = var.name | ||
| repository = var.repository | ||
| chart = var.chart | ||
| version = var.chart_version | ||
| namespace = var.namespace | ||
| atomic = var.atomic | ||
| create_namespace = var.create_namespace | ||
| wait = var.wait | ||
|
|
||
| values = var.values | ||
|
|
||
| dynamic "set" { | ||
| for_each = var.sets | ||
| content { | ||
| name = set.value["name"] | ||
| value = set.value["value"] | ||
| } | ||
| } | ||
|
|
||
| } | ||
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" { | ||
| } |
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,15 @@ | ||
| output "name" { | ||
| description = "The name of the helm release" | ||
| value = data.helm_template.main.name | ||
| } | ||
|
|
||
| output "namespace" { | ||
| description = "The namespace of the helm release" | ||
| value = data.helm_template.main.namespace | ||
| } | ||
|
|
||
| output "manifest" { | ||
| description = "Rendered Kubernetes manifests generated by Helm" | ||
| sensitive = true | ||
| value = data.helm_template.main.manifest | ||
| } | ||
|
Copilot marked this conversation as resolved.
|
||
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,20 @@ | ||
| terraform { | ||
| required_version = "~> 1.3" | ||
| required_providers { | ||
| helm = { | ||
| source = "hashicorp/helm", | ||
| version = ">= 2.17.0, < 3.0.0" | ||
| } | ||
| time = { | ||
| source = "hashicorp/time", | ||
| version = "~> 0.9.1" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "helm" { | ||
| kubernetes { | ||
| config_paths = var.kubeconfig_paths | ||
| config_context = var.kubeconfig_context | ||
| } | ||
| } |
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,83 @@ | ||
| variable "name" { | ||
| description = "The name of the helm release" | ||
| type = string | ||
| } | ||
|
|
||
| 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 "kubeconfig_paths" { | ||
| description = "List of kubeconfig paths to use for the current deployment" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "kubeconfig_context" { | ||
| description = "Kubeconfig context to use for the current deployment" | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "repository" { | ||
| description = "Repository to use for the current deployment" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "chart" { | ||
| description = "Chart to use for the current deployment" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "chart_version" { | ||
| description = "Version of the chart to use for the current deployment" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "namespace" { | ||
| description = "Namespace to use for the current deployment" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "sets" { | ||
| description = "List of sets to use for the current deployment" | ||
| type = list(map(string)) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "values" { | ||
| description = "List of values to use for the current deployment" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "atomic" { | ||
| description = "Atomic deployment" | ||
| type = bool | ||
| default = false | ||
| } | ||
|
|
||
| variable "create_namespace" { | ||
| description = "Create namespace" | ||
| type = bool | ||
| default = true | ||
| } | ||
|
|
||
| variable "wait" { | ||
| description = "Wait for deployment to complete" | ||
| type = bool | ||
| default = true | ||
| } | ||
|
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.