I am using cdktf to leverage both Terraform and direct API calls and need to store one of the attributes from a resource that I am creating/updating in a variable for some of those API calls. I’ve tried playing with TerraformOutput but haven’t succeeded. Any suggestions?
I’ll take a look at this. I take it that there is no way to do this for passing attributes to in-line function calls? Please excuse my lack of experience on this.
The provider I am using is missing some resources needed for my workflow. So basically:
API call to create thing → Terraform to provision most of thing → More API calls to finish what Terraform couldn’t
While it isn’t directly supported in cdktf (need to use escape hatches), you could use provisioners on a null resource. It’s not a generally recommended approach, but it may be the best option for your situation.
Not sure if it’s a good design practice, but could I collect the values after calling my stack and then proceed to pass them to other functions from there?
ie:
app = App()
MyStack(app, "name-here")
app.synth()
var = someWayToCollectResourceOutput.attribute
There isn’t currently an API for running the deploy (synth just creates a Terraform file to be ran by the deploy command).
You could rig something up that calls the cli commands and checks some outputted values, but it would be a bit rough.