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

Feature Request - harness_platform_file_store_file Content Input #927

Open
gallowaystorm opened this issue Feb 27, 2024 · 0 comments
Open

Comments

@gallowaystorm
Copy link

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

v1.7.3

Affected Resource(s)

Please list the resources as a list, for example:

  • harness_platform_file_store_file

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "local_file" "values_k8s" {
  count = var.type == "k8s" ? 1 : 0

  content = templatefile("${path.module}/files/k8s/values.yaml", {
    service_name           = var.service_name,
    overrides              = var.service_overrides,
    service_port           = local.service_port,
    service_target_port    = var.service_target_port,
    load_balancer_cert_arn = local.load_balancer_cert_arn,
    secrets                = var.secrets_overrides,
    use_efs                = var.use_efs
  })
  filename = "${path.module}/values.yaml"
}

resource "harness_platform_file_store_file" "values" {
  count = var.type == "k8s" ? 1 : 0

  depends_on = [local_file.values_k8s]

  org_id            = local.org_id
  project_id        = data.harness_platform_project.project.id
  identifier        = "${local.folder_id}_values_${var.environment}"
  name              = "values-${var.environment}.yaml"
  parent_identifier = local.folder_id
  file_content_path = "${path.module}/values.yaml"
  file_usage        = "MANIFEST_FILE"
}

I would like to submit a feature request for the resource harness_platform_file_store_file. Right now it does not support passing the file contents directly into it (like the local file above). This forces us to either build the file dynamically with a local file or have the file already pre-built in the repo. The issue is that most files need to be built dynamically when used in a module format to provide a module that can be used in multiple instances. Because of this we have to use a local file since harness_platform_file_store_file only supports passing in the full file directly and not the content. The local file recreates every single time due to its own limitations (please see note here = https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file). This makes the terraform output extremely messy. I would like the ability to pass the file contents directly into the harness_platform_file_store_file resource like we are doing above for the local_file.

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

No branches or pull requests

1 participant