'How to load file not using hashicorp/template in terraform
Apple M1 chip doesn't support hashicorp/template
and which result in the below error
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different
│ platforms supported.
╵
I'm looking for the alternative for data "template_file"
data "template_file" "nginx_ingress_controller" {
template = file("${path.module}/nginx_ingress_controller.yaml")
}
resource "helm_release" "nginx_ingress_controller" {
name = "my-platform"
values = [
data.template_file.nginx_ingress_controller.rendered
]
}
Solution 1:[1]
The same thing can be accomplished by using the templatefile function that is natively available in terraform v0.12
and above.
If you replace your definition above with something like this:
resource "helm_release" "nginx_ingress_controller" {
name = "my-platform"
values = [
templatefile("${path.module}/nginx_ingress_controller.yaml", {})
]
}
In addition, since it doesn't look like you're actually using the templating aspect of the templatefile functionality (note the empty map passed as the second argument to the templatefile function), you could probably get away with just using the file function to render a file's contents as a string.
resource "helm_release" "nginx_ingress_controller" {
name = "my-platform"
values = [
file("${path.module}/nginx_ingress_controller.yaml")
]
}
Finally, if you don't have any other places that require the template_file
provider, you can remove hashicorp/template
from your required providers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | logyball |