terraform-provider-helm
terraform-provider-helm copied to clipboard
Error `chart.metadata is required` when using modules with same name as helm release
I am using following project structure:
$ tree
.
├── filebeat
│ └── main.tf
└── main.tf
1 directory, 2 files
When i run terraform apply
i will get a chart.metadata is required
.
When i change the name of the module directory....
$ mv filebeat filebeat-module
...and change the module source...
module "filebeat" {
source = "./filebeat-module"
}
...and run terraform apply
again it works:
Terraform Version and Provider Version
$ terraform -v
Terraform v0.12.25
Provider Version
provider "helm" {
version = "1.2.1"
}
Affected Resource(s)
- helm_release
Terraform Configuration Files
In ./main.tf
:
module "filebeat" {
source = "./filebeat"
}
In ./filebeat/main.tf
:
provider "helm" {
version = "1.2.1"
}
resource "helm_release" "filebeat" {
name = "filebeat"
namespace = "logging"
repository = "https://helm.elastic.co"
chart = "filebeat"
version = "7.7.0"
}
Debug Output
$ terraform apply --auto-approve
module.filebeat.helm_release.filebeat: Creating...
Error: validation: chart.metadata is required
on filebeat/main.tf line 5, in resource "helm_release" "filebeat":
5: resource "helm_release" "filebeat" {
Steps to Reproduce
-
terraform init
-
terraform apply
I don't think it's related to module, as I have just got the same error without using modules.
I switched away from
repository = data.helm_repository.reponame.metadata[0].name
to a direct url
repository = "https://charts.fluxcd.io"
Terraform wanted to apply this change (why?) and now I get this
Error: validation: chart.metadata is required
It seems it is connected to https://github.com/helm/helm/issues/7862.
Here the explanation:
But, inside the function LocateChart that finds the chart it looks on the local filesystem before checking if a repo is explicitly set. If the local chart is there that is used.
I did run helm repo update
and then terraform apply
again - the issue has gone.
So it most certainly is related to the abovementioned issue.
Thanks!
I got into this again. Apparently, I have a subdirectory named flux
in the directory with the rest of the terraform files. And helm_release named flux
as well. So I renamed the flux
directory and it did the trick.
I got into this again. Apparently, I have a subdirectory named
flux
in the directory with the rest of the terraform files. And helm_release namedflux
as well. So I renamed theflux
directory and it did the trick.
IT WORKS!
I got into this again. Apparently, I have a subdirectory named
flux
in the directory with the rest of the terraform files. And helm_release namedflux
as well. So I renamed theflux
directory and it did the trick.IT WORKS!
Exactly, im storing chart in s3 and i had to change the chart name because of a local directory named the same.... For me this is utter bullsh.... If im pointing to a repository for a place where it should look for a chart im expecting it wont look for it anywhere else. And the error "validation: chart.metadata is required" says nothing 0_o For some reason in mentioned "bug report", few posts above they seem to describe this behavior as intended 0_o
Jumped into the same issue, renaming the folder does the trick! Thanks for saving my day!
Jumped into the same issue, renaming the folder does the trick! Thanks for saving my day!
Exact same here, got a directory named elasticsearch
, renamed and error disappeared!
Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!