mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-08 15:13:56 -06:00
f721608e4e
When TerraForm is used to configure and deploy infrastructure applications that require dozens templated files, such as Kubernetes, it becomes extremely burdensome to template them individually: each of them requires a data source block as well as an upload/export (file provisioner, AWS S3, ...). Instead, this commit introduces a mean to template an entire folder of files (recursively), that can then be treated as a whole by any provider or provisioner that support directory inputs (such as the file provisioner, the archive provider, ...). This does not intend to make TerraForm a full-fledged templating system as the templating grammar and capabilities are left unchanged. This only aims at improving the user-experience of the existing templating provider by significantly reducing the overhead when several files are to be generated - without forcing the users to rely on external tools when these templates stay simple and that their generation in TerraForm is justified.
27 lines
680 B
Go
27 lines
680 B
Go
package template
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
func Provider() terraform.ResourceProvider {
|
|
return &schema.Provider{
|
|
DataSourcesMap: map[string]*schema.Resource{
|
|
"template_file": dataSourceFile(),
|
|
"template_cloudinit_config": dataSourceCloudinitConfig(),
|
|
},
|
|
ResourcesMap: map[string]*schema.Resource{
|
|
"template_file": schema.DataSourceResourceShim(
|
|
"template_file",
|
|
dataSourceFile(),
|
|
),
|
|
"template_cloudinit_config": schema.DataSourceResourceShim(
|
|
"template_cloudinit_config",
|
|
dataSourceCloudinitConfig(),
|
|
),
|
|
"template_dir": resourceDir(),
|
|
},
|
|
}
|
|
}
|