unity-sds / unity-cs

Unity Common Services
Apache License 2.0
0 stars 2 forks source link

Guidance on configuring multiple providers in their terraform for marketplace #411

Open galenatjpl opened 5 months ago

galenatjpl commented 5 months ago

How do devs configure multiple providers in their terraform for marketplace to use for their deployments? We should keep in mind that providers are required to be specified when running terraform locally, so perhaps we can come up with a way that these providers can coexist for both local development/testing and marketplace deployments.

Reference https://github.com/unity-sds/unity-cs/issues/410 for some related information.

anilnatha commented 5 months ago

@galenatjpl I've been thinking about this issue and came up with an idea using additional injected variables.

If we add these new injected variables:

Variable Description
provider-ss-profile The shared services account profile name
provider-ss-region The shared services account provider's default region
provider-venue-profile The project venue's account profile name
provider-venue-region The project venue account provider's default region

Devs could add these to their variables.tf and configure their providers to use these when code is deployed via marketplace. In the case of developing and testing locally, these same variables can be defaulted using a .tfvars file using the profile name that aligns with the devs local ~/.aws/credentials file containing the temporary credentails we currently fetch from Kion.

Off the top of my head of how this could be improved is accounting for multi region support, if needed.

CC: @rtapella @wphyojpl

Edit: these variable names of course aren't final, feel free to suggest better names.

galenatjpl commented 2 months ago

The SS profile will be in place here, just in case it's needed. Most cases could leverage the resource share (SS providing shared stuff). So perhaps we can just start with these first:

provider-venue-profile | The project venue's account profile name provider-venue-region | The project venue account provider's default region

Perhaps we don't need to really pass these vars in, and instead just use a TF file that's in gitignore, for example (e.g. provider-local.tf)