Pre-run Terraform providers generation
In order for platform groups to provide services with simple configurations, there is a need to generate for Terraform some providers' configurations (by looking at the Terraform required providers). This needs to happen before Terraform initialization.
Note that no all providers require specific configuration, so we only need to generate the files based on user configuration (either in Terraform or extended API).
The flow might be:
Prior to running terraform init TF-controller requires to run terraform providers and collect a list of required providers from Terraform configuration files. TF-controller can now generate provider configration based on Terraform specific configuration or more abstracted API (e.g. TerraformProvider presented below).
Terraform spec will have the list of providers to mount. e.g.
spec:
providers:
- name: foo
targetRef: # read the information from ConfigMap or Secret
configMap:
secret:
namespace:
content: # inline content
This will generate a file relative to the path. e.g.
provider "foo" {
# content from either options
We also need a mechanism for generic providers that are generated for any terraform providers invocation.
Possible spec could include a new CRD - TerraformProvider (maybe just Provider):
metadata:
name: foo
labels:
something.something/provider-version: v1.3.5
spec:
targetRef: # read the information from ConfigMap or Secret
configMap:
secret:
namespace:
content: # inline content
That will generate foo provider configuration (unless overriden by Terraform.spec specifics).
This API will allows us to generate different provider configuration based on provider version.
Closing due to shift of priorities.