Skip to content
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

[WIP] TF Converter for Helm Release #3092

Closed
wants to merge 1 commit into from
Closed

[WIP] TF Converter for Helm Release #3092

wants to merge 1 commit into from

Conversation

EronWright
Copy link
Contributor

@EronWright EronWright commented Jul 4, 2024

Proposed changes

This PR implements support for conversion of a Terraform helm_release resource into
a Pulumi v3.Release resource.

A mapping is defined based on the schema defined in pulumi-terraform-bridge (pkg/tfbridge/info/info.go).

Example

Given this TF program:

resource "helm_release" "example" {
  name  = "redis"
  chart = "redis"
  cleanup_on_fail = true
  atomic = true
  create_namespace = true
  dependency_update = true
  description = "A Helm chart for Kubernetes"
  devel = true
  disable_crd_hooks = true
  disable_openapi_validation = true
  disable_webhooks = true
  force_update = true
  keyring = "./keyring.gpg"
  lint = true
  max_history = 5
  pass_credentials = true
  postrender {
    binary_path = "echo"
    args = [ "foo", "bar" ]
  }
  recreate_pods = true
  render_subchart_notes = true
  replace = true
  repository = "https://charts.bitnami.com/bitnami"
  repository_ca_file = "./ca.pem"
  repository_cert_file = "./cert.pem"
  repository_key_file = "./key.pem"
  repository_password = "password"
  repository_username = "username"
  reset_values = true
  reuse_values = true
  set {
    name  = "set_1"
    value = "value1"
  }
  set_list {
    name  = "set_list_1"
    value = "value1"
  }
  set_sensitive {
    name  = "set_sensitive_1"
    value = "value1"
    type = "string"
  }
  skip_crds = true
  timeout = 60
  values  = [<<-EOT
    fullnameOverride: foo
    EOT
  ]
  version = "10.7.16"
  wait = true
  wait_for_jobs = true
}

Do conversion:

pulumi convert --from terraform --language pcl

Converting to pcl...
warning: main.pp:16,3-18: unsupported attribute 'passCredentials'; unsupported attribute 'passCredentials'
warning: main.pp:17,16-20,5: ; Cannot assign value ({ args: (string, string), binaryPath: string }) to attribute of type "Optional<string>" for resource "kubernetes:helm.sh/v3:Release"
warning: main.pp:24,3-13: unsupported attribute 'repository'; unsupported attribute 'repository'
warning: main.pp:25,3-19: unsupported attribute 'repositoryCaFile'; unsupported attribute 'repositoryCaFile'
warning: main.pp:26,3-21: unsupported attribute 'repositoryCertFile'; unsupported attribute 'repositoryCertFile'
warning: main.pp:27,3-20: unsupported attribute 'repositoryKeyFile'; unsupported attribute 'repositoryKeyFile'
warning: main.pp:28,3-21: unsupported attribute 'repositoryPassword'; unsupported attribute 'repositoryPassword'
warning: main.pp:29,3-21: unsupported attribute 'repositoryUsername'; unsupported attribute 'repositoryUsername'
warning: main.pp:32,3-6: unsupported attribute 'set'; unsupported attribute 'set'
warning: main.pp:36,3-10: unsupported attribute 'setList'; unsupported attribute 'setList'
warning: main.pp:40,3-15: unsupported attribute 'setSensitive'; unsupported attribute 'setSensitive'
warning: main.pp:47,17-44: ; Cannot assign value (string) to attribute of type "Optional<Map<pulumi:pulumi:Any>>" for resource "kubernetes:helm.sh/v3:Release"
warning: main.pp:49,3-7: unsupported attribute 'wait'; unsupported attribute 'wait'

We can see that some attributes aren't easily mapped.

Related issues (optional)

Closes #2744

@EronWright
Copy link
Contributor Author

EronWright commented Jul 8, 2024

This task is looking to be impossible to do well, because the converter (pulumi-converter-terraform) is a bit too simplistic to convert all the properties (see above output). It supports renaming of properties but the shape of helm_release is quite different from v3.Release. I would guess that the TF converter assumes that the provider is bridged and that the schemas are highly compatible.

For this reason, my recommendation is that we close #2744 for now. Thoughts?

@mjeffryes mjeffryes modified the milestone: 0.107 Jul 24, 2024
@EronWright EronWright closed this Aug 16, 2024
@mjeffryes mjeffryes added this to the 0.109 milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TF Converter for Helm Release
2 participants