tofu-controller icon indicating copy to clipboard operation
tofu-controller copied to clipboard

Pre-run Terraform providers generation

Open itamar-marom opened this issue 3 years ago • 1 comments

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.

itamar-marom avatar Sep 06 '22 14:09 itamar-marom

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.

bivas avatar Sep 07 '22 08:09 bivas

Closing due to shift of priorities.

lasomethingsomething avatar Nov 06 '23 14:11 lasomethingsomething