mach-composer-cli icon indicating copy to clipboard operation
mach-composer-cli copied to clipboard

Add template option to extend generated Terraform configuration

Open tleguijt opened this issue 3 years ago • 2 comments

This could be useful for example to add extra custom Terraform providers.

For example with an terraform_extension_template: tf-tmpl.tf option in the MACH config.

tleguijt avatar Jul 21 '21 07:07 tleguijt

A direct use case. For a component using Stripe as payment provider I need to include their provider:

terraform {
  required_providers {
    stripe = {
      source = "franckverrot/stripe"
      version = "1.8.0"
    }
  }
}

BramKaashoek avatar Jul 21 '21 07:07 BramKaashoek

Also support variables (varfile and env) like so:

terraform {
  required_providers {
    stripe = {
      source = "franckverrot/stripe"
      version = "1.8.0"

      username = ${var.provider.username}
      username = ${env.STRIPE_USERNAME}
    }
  }
}

tleguijt avatar Jul 22 '21 09:07 tleguijt

I think this can now be achieved via plugins.

Of course creating a plugin for only adding a provider seems overkill. But it's quite easy to create a reusable provider setting plugin (mach-composer-plugin-add-providers)

Agree to close?

mvantellingen avatar Dec 02 '22 16:12 mvantellingen

Agree with the approach. Let's close this once we have some clear instructions on this in the documentation

tleguijt avatar Dec 05 '22 07:12 tleguijt