lively-laptop-35163
08/30/2022, 4:42 PMproud-machine-85126
08/31/2022, 4:05 AMprehistoric-sandwich-7272
08/31/2022, 8:03 PM{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "my-bucket",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::my-bucket/*"
],
"Principal": {
"Oai": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity <ID>"
}
}
]
}
Now I have a second s3 folder, under the same bucket, for a second service, called ‘service2’. I created an OAI for the folder and cloudfront aswell, and I want to attach a new statement to the existing bucket policy. so something like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "my-bucket",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::my-bucket/*"
],
"Principal": {
"Oai": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity <123>"
},
{
"Sid": "my-bucket",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::my-bucket/*"
],
"Principal": {
"Oai": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity <456>"
}
}
]
}
How can I achieve this?most-mouse-38002
09/01/2022, 4:49 PMIDOutput
I get
panic: applier must have 1 input parameter assignable from pulumi.ID
Code is as follows
scope := x.ID().
ApplyT(func(data string) string {
return data + "providers/Microsoft.Network"
}).(pulumi.StringOutput)
ripe-shampoo-80285
09/01/2022, 8:30 PMsalmon-account-74572
09/01/2022, 8:43 PMctx.Export("privSubnetIds", pulumi.StringArray(privSubnetIds))
I have a second stack in which I need to reference these subnet IDs to launch EC2 instances. I have a StackReference to the base infrastructure stack, but the only way I’ve been able to reference the private subnet IDs has been this incantation:
privSubnetsOutput := ref.GetOutput(pulumi.String("privSubnetIds")).ApplyT(func(out interface{}) []string {
var res []string
if out != nil {
for _, v := range out.([]interface{}) {
res = append(res, v.(string))
}
}
return res
})
Followed by extracting the first subnet:
firstPrivateSubnet := privSubnetsOutput.ApplyT(func(a []string) string {
var res string
if len(a) > 0 {
res = a[0]
}
return res
}).(pulumi.StringOutput)
If I want now to extract the second subnet, I’d have to repeat this but retrieving a[1]
instead. Surely there’s a better way to go about this?ripe-shampoo-80285
09/01/2022, 9:29 PMgorgeous-sunset-66503
09/07/2022, 3:57 PMgorgeous-sunset-66503
09/07/2022, 3:57 PMgorgeous-sunset-66503
09/07/2022, 3:58 PMgorgeous-sunset-66503
09/07/2022, 4:00 PMgorgeous-sunset-66503
09/07/2022, 4:00 PMgorgeous-sunset-66503
09/07/2022, 4:00 PMgorgeous-sunset-66503
09/07/2022, 4:03 PMsalmon-account-74572
09/07/2022, 4:51 PM_, err := ec2.NewVpc
)? Typically you’ll need to keep that value so you can reference it later with other objects (subnets, route tables, etc.).gorgeous-sunset-66503
09/07/2022, 5:00 PMgorgeous-sunset-66503
09/07/2022, 5:00 PMgorgeous-sunset-66503
09/07/2022, 5:01 PMCannot use 'pulumi.String("10.0.0/16")' (type pulumi.String) as the type pulumi.StringInput Type does not implement 'pulumi.StringInput' need the method: ToStringOutput() StringOutput have the method: ToStringOutput() StringOutput
gorgeous-sunset-66503
09/07/2022, 5:01 PMgo 1.18
require (
<http://github.com/pulumi/pulumi-aws/sdk|github.com/pulumi/pulumi-aws/sdk> v1.31.0
<http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.39.1
)
salmon-account-74572
09/07/2022, 5:35 PMimport
, you’re referencing <http://github.com/pulumi/pulumi-aws/sdk/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/go/aws/ec2>
, but the example references v5 (<http://github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2>
). You may want to update your imports and go.mod
and see if that helps.gorgeous-sunset-66503
09/07/2022, 5:35 PMbitter-kite-21926
09/07/2022, 9:09 PMfailed: err=determining go version: exit status 2
most-mouse-38002
09/13/2022, 10:10 AMswift-machine-98066
09/16/2022, 3:15 PMflaky-arm-38472
09/21/2022, 3:58 AM"template_file" "userdata" {}
resource on Pulumi , specifically to use an userdata.sh
file that contains the user data for an EC2 instance, but inside this file I want to extrapolate some variables from my program. In Terrafrom one could do:
data "template_file" "userdata" {
template = file("${path.module}/userdata.sh")
vars = {
env = "dev"
}
And then on my userdata.sh
file just reference the variable:
#!/bin/bash -xe
MYENV=${env}
Something similar exist on Pulumi or do I have to make a go file to store the user data and do the replacement over there?swift-machine-98066
09/21/2022, 9:00 PMpulumi.StringMap
trying to process it in another stack but getting a pointer address instead of the value. trying some thing along the lines of
stackName := config.Require(ctx, "network:vpc")
region := config.Require(ctx, "aws:region")
s := fmt.Sprintf("%s-%s-subnets", region, stackName)
subnets := other.GetStringOutput(pulumi.String(s))
fmt.Println(string(subnets.ToStringOutput()))
some reason ToStringOutput only returns a pulumi.StringOutput and not a string like I would expect it to be .lively-table-10226
09/23/2022, 8:01 AMcurved-hair-82998
09/23/2022, 8:27 PMDuplicate resource URN 'urn:pulumi:dev::awsBase-Pulumi::pulumi:pulumi:Stack::awsBase-Pulumi-dev'; try giving it a unique name
[1:56 AM] this is my code structure
- aws
- resources
s3.go
vpc.go
- main.go ( calling s3 and vpc)
- go.sum
- go.mod
- pulumi.yaml
swift-machine-98066
09/24/2022, 1:27 AMEgress: ec2.NetworkAclEgressArray{
&ec2.NetworkAclEgressArgs{
Action: pulumi.String("allow"),
CidrBlock: pulumi.String("0.0.0.0/0"),
FromPort: <http://pulumi.Int|pulumi.Int>(0),
Protocol: pulumi.String("-1"),
RuleNo: <http://pulumi.Int|pulumi.Int>(900),
ToPort: <http://pulumi.Int|pulumi.Int>(0),
},
? As i'm going to have multiple subnets for various rules I need to generatedelightful-daybreak-41063
09/26/2022, 10:32 PMpulumi up
and install stuff via UserData, but now I’m hoping to sidestep the pulumi up
command and just start the instance in the CLI app?
I see that I can import github.com/pulumi/pulumi/pkg/v3/cmd/pulumi is made public in go mod
, and I have access to the NewPulumiCmd() cobra.Cmd
, which seems to be the only valuable thing that is exported. I assumed I could just call the NewPulumiCmd.Run()
and pass in any cli parameters I would have normally passed in, but that package is “package main”, so go doesn’t want me to import it, giving the error: import "<http://github.com/pulumi/pulumi/pkg/v3/cmd/pulumi|github.com/pulumi/pulumi/pkg/v3/cmd/pulumi>" is a program, not an importable package
.
Is this a problem that has been asked about before? Is this the first time it has been asked? Is this just the wrong thing to be doing with the tool? Are we opposed to moving all the sub-commands to a nested package (i.e. /pkg/cmd/pulumi/cmds/up.go) and making them Public?