https://pulumi.com logo
#typescript
Title
# typescript
c

calm-greece-42329

10/15/2020, 7:24 PM
for example, if i include a CloudWatch LogGroup in the returned class, i want people to be able to change the retention days, without having the parameterize everything in my new classes constructor, but
retetionInDays
is readonly
g

green-school-95910

10/15/2020, 7:37 PM
It is not possible by the design. The inputs are only defined on the constructors, the properties of the instance are `Output`s, even if you bypass typing you would not change anything. You can have the arguments of the subresources as optional parameter on your resource options. Or... you can make a builder class. I would consider making a builder class for Pulumi a blasphemy punishable by a sword, but if you can sleep at night with that go for it
c

calm-greece-42329

10/15/2020, 7:45 PM
ahahaha
whats the pulumi way to implement something like whats going on here for building this step function? https://docs.aws.amazon.com/cdk/api/latest/docs/aws-stepfunctions-readme.html#example
g

green-school-95910

10/15/2020, 8:24 PM
AWS CDK is a IaaS like Pulumi, but only for AWS The stepfunctions package and related build a representation of the state and steps and when they are combined in the StateMachine object it translates to the CDK resources. There is an whole lot of work to port all of that to Pulumi, but it is possible. You can follow their code on how they do it and replicate it, at the last step build Pulumi resources instead of CDK resources.
c

calm-greece-42329

10/15/2020, 8:26 PM
yeah, sorry i wasn’t clear. i’d like to improve the step function situation (json blobs) and was thinking it would look like CDKs implementation with the builder. but if not, what would be the right way to implement it in pulumi?
g

green-school-95910

10/15/2020, 8:31 PM
It does a whole lot of things, each one might require something different. But as an overview, the lambdas would stay as lambda resources, you would need to make the objects representing the workflow (the classes from "Amazon State Language") and the code translating those objects to lambda. That would go inside a StateMachine ComponentResource.
👍 1
I'm must admit I'm tempted to try making something like this but agnostic provider, maybe even allow pieces in different providers
It's literally designing itself in my head while I work
w

wet-soccer-72485

10/16/2020, 4:30 PM
I kind of have a similar-ish future usecase that I’ve been thinking about recently, if I’m reading this right. I want to be able to bring up temporary resources in prep for a product deployment (increase the number of replicas for a kubernetes deployment). The way I was planning on doing this was to create a little Slack bot which would kick off GitOps scripts to change a config value (like the number of replicas + a git hash to change the app code), wait for a successful or failed run, and then depending on that, adjust the config values differently (to scale down number of temporary replicas)
c

calm-greece-42329

10/16/2020, 5:34 PM
@green-school-95910 well if you make any decisions here and can use some help, i can likely make some time available.
i’ve started some work on implementing tasks and generating the state machine definition, but its going to be a pretty large amount of work to support everything
g

green-school-95910

10/17/2020, 5:28 PM
Yeah, I won't have that much free time, it is on my list of ideas for me to continue one day. Maybe I'll do a portion of it for fun, but to make it in a reliable way and specially test it will be a nightmare
If you share the repo you are working one I might help
c

calm-greece-42329

10/20/2020, 4:59 PM
unrelated to the sfn problem we were discussing, but related to the original question about why i wanted to update existing resources.
Overwrite
allowed me to do what i needed to simplify creation of common dependencies in https://github.com/pulumi/pulumi-awsx/pull/590
3 Views