terraform-provider-helm icon indicating copy to clipboard operation
terraform-provider-helm copied to clipboard

Fail on invalid chart

Open AndiDog opened this issue 6 years ago • 3 comments

Current situtation: if the chart is malformed, but the Helm release was already installed earlier, terraform apply will not display any error. I have a case where no resource "helm_release" "foo" { version = ... is given, so always the latest chart version should be taken. Terraform would then not hint that the chart is malformed, but silently "succeed", i.e. return an empty plan/apply result and the chart upgrade won't be attempted.

This patch fixes that and adds two tests (problems in Chart.yaml and requirements.yaml, respectively).

AndiDog avatar May 22 '19 12:05 AndiDog

What about the failed test?

--- FAIL: TestAccResourceRelease_repository (0.19s)
    testing.go:568: Step 0 error: errors during plan:
        
        Error: failed to get chart metadata (malformed chart?): Non-absolute URLs should be in form of repo_name/path_to_chart, got: coredns

I feel this might be a bug in func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, getter.Getter, error). These are the resources used for the test:

func testAccHelmReleaseConfigRepository(resource, ns, name string) string {
	return fmt.Sprintf(`
		resource "helm_repository" "stable_repo" {
			name = "stable-repo"
			url  = "https://kubernetes-charts.storage.googleapis.com"
		}

		resource "helm_release" %q {
			name       = %q
			namespace  = %q
			repository = "${helm_repository.stable_repo.metadata.0.name}"
			chart      = "coredns"
		}
	`, resource, name, ns)
}

and the function should consider the helm repo URL correctly, no?

AndiDog avatar May 28 '19 09:05 AndiDog

Any input why the test would fail?

AndiDog avatar Jul 11 '19 10:07 AndiDog

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Mar 12 '22 17:03 hashicorp-cla