upbound/provider-terraform

Support Partial Backend Configuration

rodrigorfk opened this issue · 0 comments

What problem are you facing?

Currently it's possible to define backend configuration at ProviderConfig level via the configuration field, that definitely works for some use cases, however terraform also support partial backend configuration as documented here, this feature allows module authors to partially define the terraform backend in the module codebase as following:

# backend.tf
terraform {
  backend "s3" {}
}

and then have an extra backend configuration file defining the backend fields as following

# crossplane.remote.tfbackend
encrypt = true
bucket = "some-s3-bucket"
dynamodb_table = "some-dynamodb-table"
key = "terraform.tfstate"
workspace_key_prefix = "some-prexy"
region = "some-aws-region"

The mentioned backend configuration file is then provided as an argument during terraform init as following:

terraform init -backend-config=crossplane.remote.tfbackend ...

How could Official Terraform Provider help solve your problem?

It would be great if the Terraform Provider could support partial backend configuration. This support would enable companies that already have modules written for Partial Backend Configuration to seamlessly transition to using Crossplane without needing to make any changes to their modules. Currently, there's a limitation in using modules with partial backend configuration alongside the existing backend configuration support in the Terraform Provider, if an existing module has a partial backend defined in its codebase, and the ProviderConfig is set up to define the full backend in the configuration as well, the Terraform CLI will encounter an error and abort, the error message will indicate that multiple backends are defined, creating a conflict.