https://pulumi.com logo
#general
Title
# general
h

handsome-actor-1155

06/04/2019, 6:27 PM
I am trying to access a stack output of a different stack, in this case a bucketName, like so:
Copy code
const kafkaBucket = new aws.s3.Bucket("stream-demo-kafka-bucket");
export const bucketName = kafkaBucket.bucket;
....
#newProject
const infraStack = new pulumi.StackReference("fqdn-stackname");
const bucketName = infraStack.getOutput("bucketName");
In this case, bucketName is of type
Output<any>
and I want to turn it into a string to use in a K8s ReplicaSet deployment. I’ve tried:
const bucketName = infraStack.getOutput("bucketName").apply(bucket => bucket);
but that is still type
Output<any>
The closest I’ve gotten is setting the parameter type of my ReplicaSet function to type
Output<any>
then when using it in my config, I do
Copy code
... }, {
                                name: "S3_BUCKET_NAME",
                                value: pulumi.interpolate `${bucketName}`
                            }...
Pulumi actually renders this as an update (I previously hardcoded the string) shown as:
Copy code
~ value: "steam-demo-kafka-bucket-339079d" => "stream-demo-kafka-bucket-339079d"
I’m assuming that is really the same value? Is there a better way of getting the output?
I did just realize that the first value is a type, so my question about the values being the same has been answered. I’m still wondering if there is a cleaner way of doing this?