helpful-afternoon-10938
11/19/2021, 6:44 PMdiff = stack.preview(diff=True)
print(diff.change_summary)
but I need the changed resource in some json formatred-match-15116
11/19/2021, 6:45 PMPreviewResult
which is what you're getting from stack.preview
You might want to do diff = stack.preview(diff=True, on_output=print)
on_event
callback
stack.preview(on_event=print)
print is just an example here but you can get all of the diff information from the events generated by on_eventResourcePreEvent
specifically.helpful-afternoon-10938
11/19/2021, 6:48 PMred-match-15116
11/19/2021, 6:50 PMhelpful-afternoon-10938
11/19/2021, 7:06 PMpulumi:pulumi:Stack: (same)
[urn=urn:pulumi:test::BMasServiceEKS::pulumi:pulumi:Stack::BMasServiceEKS-test]
~ aws:ec2/securityGroup:SecurityGroup: (update)
[id=sg-fhc56yrrhc6rh]
[urn=urn:pulumi:test::BMasServiceEKS::aws:ec2/securityGroup:SecurityGroup::allowTls]
[provider=urn:pulumi:test::BMasServiceEKS::pulumi:providers:aws::default_4_26_0::htrddhrt-hrthhrd-4e48-9ed2-dhrrtyrddrt]
~ ingress: [
~ [0]: {
~ cidrBlocks: [
- [0]: "0.0.0.0/0"
]
- fromPort : 22
- protocol : "tcp"
- toPort : 22
}
]
red-match-15116
11/19/2021, 7:14 PMon_event
. Maybe something like:
stack.preview(on_event=json.dumps)
Or even:
def print_resource_pre_as_json(evt: auto.EngineEvent):
if evt.resource_pre_event:
json.dumps(evt.resource_pre_event)
stack.preview(on_event=print_resource_pre_as_json)
helpful-afternoon-10938
11/21/2021, 4:01 PM