https://pulumi.com logo
Docs
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
general
  • s

    stocky-spoon-28903

    06/04/2019, 12:16 PM
    Since it retains the map bit too
  • t

    tall-librarian-49374

    06/04/2019, 12:16 PM
    Yours doesn't compile 😋
  • s

    stocky-spoon-28903

    06/04/2019, 12:17 PM
    Heh, Slack is not an IDE 😉
  • s

    stocky-spoon-28903

    06/04/2019, 12:17 PM
    @powerful-london-34081 that’s an interesting question: I suspect so.
  • p

    powerful-london-34081

    06/04/2019, 12:17 PM
    that blows my mind
  • s

    stocky-spoon-28903

    06/04/2019, 12:17 PM
    To be fair this is also a limitation on how Terraform implemented the resource, which is kind of strange.
  • g

    glamorous-manchester-77008

    06/04/2019, 12:17 PM
    I have successfully deployed a lambda via pulumi. I want to provide secrets for the lambda by making a runtime lookup of the parameter towards Aws SSM (Parameter Store). This fails with access denied. What I want to do is to provide an IAM policy for the role associated to the lambda. However, I don't see any way in the docs or via the typescripts definiitons on how to provide IAM polcicies for the lambda. Does anyone know how one would go about this?
    t
    • 2
    • 5
  • s

    stocky-spoon-28903

    06/04/2019, 12:18 PM
    Can you try @tall-librarian-49374’s version and see if it works?
  • s

    stocky-spoon-28903

    06/04/2019, 12:18 PM
    Or rather, see if it does what you expect
  • p

    powerful-london-34081

    06/04/2019, 12:20 PM
    will do. I guess this approach would work regardless of whether it was a pulumi/terraform bug or a GCP limitation
  • s

    stocky-spoon-28903

    06/04/2019, 12:21 PM
    I don’t know exactly what the underlying API is here
  • p

    powerful-london-34081

    06/04/2019, 12:27 PM
    I'm sifting through gcp docs to make sense of this
  • p

    powerful-london-34081

    06/04/2019, 12:29 PM
    either their CLI/WebUI is doing some hidden magic, updating existing bindings, and displaying them as separate bindings (in which case maybe pulumi should too?), or this doesn't make any sense at all (might just be me though).
  • w

    witty-alarm-17249

    06/04/2019, 12:30 PM
    Hello I tried to create an Azure VM from an image that have a data disk
  • w

    witty-alarm-17249

    06/04/2019, 12:31 PM
    Untitled.js
  • w

    witty-alarm-17249

    06/04/2019, 12:32 PM
    without diskSizeGb it is not working, it complains that "Value '0' must be between '1' and '32767'"
  • w

    witty-alarm-17249

    06/04/2019, 12:33 PM
    same for diskSizeGb=null
  • w

    witty-alarm-17249

    06/04/2019, 12:34 PM
    I'm supposing it is an pulumi issue and not a terraform one
    b
    t
    s
    • 4
    • 44
  • s

    stocky-spoon-28903

    06/04/2019, 12:36 PM
    @witty-alarm-17249 Is this in a
    azure.compute.VirtualMachine
    resource?
  • w

    witty-alarm-17249

    06/04/2019, 12:36 PM
    correct
  • w

    witty-alarm-17249

    06/04/2019, 12:38 PM
    -.js
  • p

    powerful-london-34081

    06/04/2019, 12:47 PM
    @stocky-spoon-28903 @tall-librarian-49374 you're right, I have confirmed the behavior you described. The gcloud cli and webui allows for adding/removing single bindings regardless of whether an existing policy exists. Do you think it would make sense for pulumi to provide the same convenience? If so, I'll create an issue for it.
  • s

    stocky-spoon-28903

    06/04/2019, 12:48 PM
    @powerful-london-34081 yes i think that would not be a bad plan
  • s

    stocky-spoon-28903

    06/04/2019, 12:49 PM
    Please open an issue for that - in the meantime are you unblocked though?
  • a

    adventurous-jordan-10043

    06/04/2019, 4:22 PM
    Can
    PULUMI_TEST_MODE
    work with a local stack ?
    w
    • 2
    • 7
  • 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:
    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
    ... }, {
                                    name: "S3_BUCKET_NAME",
                                    value: pulumi.interpolate `${bucketName}`
                                }...
    Pulumi actually renders this as an update (I previously hardcoded the string) shown as:
    ~ 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?
    • 1
    • 1
  • b

    big-knife-4134

    06/04/2019, 6:50 PM
    const region = pulumi.output(aws.getRegion())
    
    const policy = {
    	Version: '2012-10-17',
    	Statement: [{
    		Action: [
    			'logs:*'
    		],
    		Effect: 'Allow',
    		Resource: [
    			pulumi.interpolate`arn:aws:logs:${region.name}:*:*`
    		]
    	}]
    }
    
    export const cloudwatchLogsPolicy = new aws.iam.Policy('cloudwatchLogsPolicy', {
    	policy: JSON.stringify(policy)
    })
    @handsome-actor-1155 in the same vein, albeit with intra-stack dependencies, I am finding out using an output with interpolate (or apply) doesn’t work with JSON.stringify. Probably different from your problem, but I just came across this issue and saw your post. From my reading of the docs, the way you’re defining it appears to be the cleanest way. Seems to be some gotchas with pulumi.interpolate that I’m not seeing?
    h
    g
    w
    • 4
    • 19
  • a

    average-dream-51210

    06/04/2019, 8:15 PM
    Hm, are Pulumi stacks something that seperates bags of config variables?
  • q

    quaint-queen-45003

    06/04/2019, 8:32 PM
    hello, im trying to add
    autoScalingGroupTags
    to my nodegroups where the key of a tag has a string substitution but i'm hitting a yaml formatting error. Code sample in thread
    w
    g
    • 3
    • 13
  • a

    average-dream-51210

    06/04/2019, 8:54 PM
    With Javascript, if I have 3 files importing a vpc resource from a vpc.js file - will it create 3 different VPCs? Or will it share one VPC? I'd like for it to share one VPC but able to abstract the VPC out into a file that other files can share.
    p
    g
    i
    • 4
    • 17
Powered by Linen
Title
a

average-dream-51210

06/04/2019, 8:54 PM
With Javascript, if I have 3 files importing a vpc resource from a vpc.js file - will it create 3 different VPCs? Or will it share one VPC? I'd like for it to share one VPC but able to abstract the VPC out into a file that other files can share.
p

proud-alarm-92546

06/04/2019, 9:09 PM
I have guesses, but haven't tested this: waiting for answers. 🙂
g

gentle-diamond-70147

06/04/2019, 9:18 PM
It will create and share the one vpc.
Someone else can articulate it better than me, but the way imports are handled it will essentially result in one vpc getting created and shared.
Here's a quick example - https://gist.github.com/clstokes/2e8f5be18d05539e0b2269aa667c71e2.
a

average-dream-51210

06/04/2019, 9:48 PM
Ah thanks! Must be a state mismatch issue on my end then 🙂
p

proud-alarm-92546

06/04/2019, 10:05 PM
[pure speculation] it probably depends on how you're consuming the vpc.js~ - if you're consuming it from multiple states, it's going to create one per state. if it's from the same state, it's going to know about it. I think there's some way to share state/state knowledge, but I haven't gotten back to that problem myself yet.
er, stack, not state.
g

gentle-diamond-70147

06/04/2019, 10:36 PM
The example I posted is for using a single
vpc.js
in a single Pulumi application.
The VPC created will be scoped to the current stack that's selected.
So yes, if you create and select a different stack, it will create a different VPC.
a

average-dream-51210

06/05/2019, 12:38 AM
ahh thanks!
So nodejs imports are Singletons
Subsequent imports will point to the same object in memory that was instantiated the FIRST time it was imported.
i

important-carpenter-15282

06/05/2019, 2:05 AM
Well, yes and no.
Depends on what you export.
The better way to think about this is that you’re creating a single object and exporting it. If you created a function that returns a VPC and called it multiple times you’d get multiple VPCs.
⬆️ 1
a

average-dream-51210

06/05/2019, 3:43 AM
ahhhh icic, cool!
View count: 1