'Is it possible to export shell environment variables using terraform

My use case is that, for example, my main.tf is creating 4 resources

resource "a" {}
resource "b" {}
resource "c" {}
resource "d" {}

So the resource "d" needs a shell environment to be present. So is there a way that I can export a shell environment variable ( export username = test ) in resource "c"?



Solution 1:[1]

with terraform you can use module

local-exec

and then dive in to your bash skills from there. Including catching terminal env's

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Victor Biga