Hi <@UB8C33JJG> - I've fell in love with Pulumi bu...
# general
m
Hi @echoing-match-29901 - I've fell in love with Pulumi but I'd also like to use Stax.io as well for governance controls. Stax.io has packages which are based on CloudFormation templates. Can I use Pulumi to generate Terraform creation/update/deletion scripts managed by an external stack? I'm based in AU and doing a special purpose POC and have contacts internally at Stax.io in AU who I can engage to help solve 'wicked problems' which could include interop between the platforms
e
Can I use Pulumi to generate Terraform creation/update/deletion scripts managed by an external stack?
This isn't possible. The values for pulumi programs come the user program and we can't run and inspect that without actually doing a the update operations associated with it.
m
Fraser thanks for context however I think we are missing. Understanding I can import existing elements (VPC etc) my workflow would be: • Deploy Stax.io 'base infrastructure' • Import into Pulumi stack • Write 'code' to change infrastructure (eg deploy EKS) • Run something like
Pulumidiff-script
that makes a change terraform but does not execute the script against AWS. • Execute terraform via Stax.io tools Is something like that possible? Or is it all or nothing type thing?
Something like a dry run that outputs a script
e
Something like a dry run that outputs a script
Yeh that type of thing isn't possible. Consider a really simple pulumi program like the below:
Copy code
const store = new aws.s3.Bucket("kops-state-store");

const cluster = new eksdistro.Cluster("cluster", {
    name: "<http://luke.cluster.pulumi-demos.net|luke.cluster.pulumi-demos.net>",
    state: pulumi.interpolate`s3://${store.id}`,
});
At preview we can't see what that interpolate resolves to because we don't have an
id
for the store yet. And while it looks like we could maybe template out a simple case like this in general the behaviour of interpolate or apply can do anything your programming language can express. How could we possibly turn the following into a terraform script?
Copy code
const bucket = new aws.s3.Bucket("some-bucket");
const nmae = bucket.id.apply(some_http_call_to_get_name_based_on_bucket_id)
const cluster = new eksdistro.Cluster("cluster", {
    name: name,
    state: pulumi.interpolate`s3://${store.id}`,
});
So you can't turn a pulumi program into a terraform script. You can use pulumi to import resources that we're made by a terraform script, either via tf2pulumi or by just running the
pulumi import
command.
m
Cool makes complete sense. I'd assumed that as Pulumi used Terraform to execute the AWS changes that it may be possible to hook the process and say just export not apply to AWS cloud. Its a bummer because both are awesome products. But other than a 'nice gui' Stax.io features can be implemented with Pulumi scripts. You even have
pulumi-awsx
which has the best practice part.
I'll chat to Stax.io and re-engage if I have any questions.
👍 2
e
Always here to answer questions 🙂
m
Thanks, Fraser. Is
pulumi-awsx
mainly feature complete or do you (or the community) plan to extend the package. I've only completed basic tasks (Build VPC, Subnets (which the auto-sizing was awesome!). EKS). I'm a developer so would prefer Infra as Code vs a pretty GUI that I essentially have to load terraform scripts into after an initial 'build wizard'
e
I believe our devrel team (who are mostly in America so timezones they won't see this till later today) are planning on doing more work for awsx.
And of course if you want to see more things don't hesitate to raise tickets on the github for it, and contributions are always welcome
🙌 1
l
My take on this is to talk to some Pulumi people who are involved in generating the AWS & GCP native providers for Pulumi. These are generated from a specification. Given Stax.io also has an API, I would see how much work it is to generate a Pulumi provider from the Stax API spec.
a
(For folks following along - @most-pager-34456 and i connected, and I'm going to dig into seeing how there might be some neat stuff with Pulumi and Stax) That said, I didn't know our devrel team (I'm on it lol) got signed up to work on the awsx provider. Nobody tells me anything :)
(Last paragraph was for comedic purposes)
m
Matty I'm looking forward to making these platforms awesome! Not just for me but also the platforms.