delightful-camera-97029
01/11/2023, 1:21 PMpulumi up, pulumi destroy, etc
for multiple stacks? and get the output of all these stacks in a json structured file?billowy-needle-56870
01/12/2023, 10:29 PMs3Bucket, err := s3.NewBucket(ctx, "demo", &s3.BucketArgs{})
iam.NewPolicy(ctx, "demo", &iam.PolicyArgs{
Policy: pulumi.Sprintf(`{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": s3Bucket.ARN
}
]
}`),
gorgeous-architect-28903
01/19/2023, 3:46 PMgifted-fall-44000
01/23/2023, 7:48 PMincalculable-crayon-23090
01/25/2023, 8:42 AMstocky-jelly-20386
02/01/2023, 12:04 AMgorgeous-printer-90037
02/01/2023, 2:58 PMOutput
without having to do any funky `Apply`s? I’m just trying to read some remote Terraform state and create a new struct with information from there as I see fit, but I see no easy way to do itbrash-gigabyte-81569
02/07/2023, 3:52 PMbrave-waitress-3546
02/19/2023, 9:40 AMartifactregistry.NewRepositoryIamMember(ctx, fmt.Sprintf("iam-member-%v",serviceAccount.Name), nil)
Gives me a resource name iam-member-{0x14000236a80}
Is there any way to convert it to a string properly. there are no methods to do so on the StringOutput itself, tried the ApplyT with type conversion to, give me the same result.straight-caravan-63576
02/19/2023, 2:02 PM//vFS *efs.FileSystem
//efsid pulumi.Output
volumes := []string{}
all := pulumi.All(vFS.ID())
efsid := pulumi.All(all).ApplyT(
func(args []interface{}) pulumi.StringOutput {
return pulumi.Sprintf("%v", all)
})
// Below append doesnt work.
volumes = append(volumes, `"efs-data": {
"name": "efs-data",
"efsVolumeConfiguration": {
"fileSystemId": "`+efsid+`", // <<<<< HERE
"rootDirectory": "/mnt/efs"
}
}`)
sticky-bear-14421
02/24/2023, 6:31 AMflat-kangaroo-13810
03/04/2023, 8:50 PMerror: an unhandled error occurred: program failed:
1 error occurred:
* decoding YAML: rpc error: code = Unknown desc = invocation of kubernetes:yaml:decode returned an error: failed to initialize discovery client: The gcp auth plugin has been removed.
Please use the "gke-gcloud-auth-plugin" kubectl/client-go credential plugin instead.
See <https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke> for further details
I figured out this is caused because during "pulumi preview" the kubeconfig does not exist on the server it returns a empty string.
So the provider cannot create with an empty kubeconfig.
I have used DependsOn with all the previous commands required for it to work, but it seems that it always executes the command and tries to build the provider off an empty string.
If I bypass preview with "pulumi up -f", everything works without issue.
Sample Code:
func (k *K3sCluster) exportKubeProvider(node K3sClusterNode, dependsOn ...pulumi.Resource) (*remote.Command, *kubernetes.Provider, error) {
t := remote.ConnectionArgs{}
t.Host = pulumi.String(node.IP)
t.Password = pulumi.String(nodePassword)
t.User = pulumi.String(nodeUsername)
c := remote.CommandArgs{
Connection: t.ToConnectionOutput(),
Create: pulumi.String("sudo cat /etc/rancher/k3s/k3s.yaml").ToStringPtrOutput(),
}
a, err := remote.NewCommand(k.ctx, fmt.Sprintf("get-k3s-kubeconfig-%s", node.Name), &c, pulumi.DependsOn(dependsOn))
if err != nil {
return nil, nil, err
}
dependsOn = append(dependsOn, a)
provider, err := kubernetes.NewProvider(k.ctx, "k3s-provider", &kubernetes.ProviderArgs{
Kubeconfig: a.Stdout.ApplyT(func(config string) string {
config = strings.Replace(config, "<https://127.0.0.1:6443>", fmt.Sprintf("<https://%s:6443>", node.IP), -1)
return config
}).(pulumi.StringOutput).ToStringPtrOutput(),
}, pulumi.DependsOn(dependsOn))
if err != nil {
return nil, nil, err
}
//k.ctx.Export("kubeconfig", config)
dependsOn = append(dependsOn, provider)
ingress, err := yaml.NewConfigFile(k.ctx, "k8s-ingress-nginx", &yaml.ConfigFileArgs{
File: "pkg/kube/yaml/ingress-nginx.yaml",
}, pulumi.Providers(provider), pulumi.DependsOn(dependsOn))
if err != nil {
return nil, nil, err
}
dependsOn = append(dependsOn, ingress)
_, err = yaml.NewConfigFile(k.ctx, "k8s-ingress-nginx-load-balancer", &yaml.ConfigFileArgs{
File: "pkg/kube/yaml/loadbalancer-nginx.yaml",
}, pulumi.Providers(provider), pulumi.DependsOn(dependsOn))
if err != nil {
return nil, nil, err
}
return a, provider, nil
}
Thread in #generalbusy-room-61756
03/06/2023, 8:55 PMsparse-intern-71089
03/12/2023, 5:12 PMbored-vr-79323
03/22/2023, 4:17 PMtls.NewPrivateKey
method from the github.com/pulumi/pulumi-tls/sdk/v4/go/tls package. The code generates keys outside of a test but not in it. Is this not the correct way to do it:
func TestGenerateSSHKey(t *testing.T) {
config := map[string]string{}
err := pulumi.RunErr(func(ctx *pulumi.Context) error {
pulumiKey, err := tls.NewPrivateKey(ctx, "private-key", &tls.PrivateKeyArgs{
Algorithm: pulumi.String("ECDSA"),
EcdsaCurve: pulumi.String("P521"),
})
if err != nil {
t.Logf("Error generating SSH key: %s\n", err)
return err
}
pulumi.All(pulumiKey.PrivateKeyOpenssh).ApplyT(func(args []interface{}) interface{} {
pKey := args[0]
t.Logf("Private key: %s\n", pKey)
if pKey == "" {
t.Log("Error generating SSH key: private key is empty")
t.Fail()
}
return pKey
})
return nil
}, WithMocksAndConfig("opp-notary-composer", "opp-notary-composer-dev", config, mocks(0)))
if err != nil {
t.Log(err)
t.Fail()
}
}
I’ve looked through the unit testing and integration testing docs but haven’t been able to figure it out. Would appreciate if there were docs/examples to look at. Thanks. 🙏🏼plain-parrot-21984
03/24/2023, 10:30 AMplain-parrot-21984
03/24/2023, 12:21 PM"Resource": "{0xc0001a6b60}"
. Looking at the example on https://www.pulumi.com/registry/packages/aws-native/api-docs/stepfunctions/statemachine/ the DefinitionString should be a string as the name implies. I chose to define the state in a separate variable first, because hard coding the Arn like in the example isn't really feasible. How can I supply the correct Arn to the definition instead of the memory address?plain-parrot-21984
03/27/2023, 9:41 AMplain-parrot-21984
04/03/2023, 11:18 AMbitter-energy-6777
04/06/2023, 6:44 PMadorable-scooter-32619
04/07/2023, 10:27 AMpulumi.ResourceOptions
and pulumi.ResourceOption
and there difference. In our old Python stack, we always used the ResourceOptions and use that through all components. In Go, all components always wants pulumi.ResourceOption
(opts ...pulumi.ResourceOption
).
What is the missing part we dont unterstood? :/ We studied the docs but there was not really helpful and finding go examples on github is very hard.
Thanks for your help! :)magnificent-dress-31519
04/11/2023, 9:20 AMpolite-sandwich-68547
04/12/2023, 4:25 PMpulumi.StringOutput
to a normal go string
?brash-painting-89833
04/12/2023, 6:16 PMvpc, err := ec2.NewVpc(ctx, name, &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
InstanceTenancy: pulumi.String("default"),
Tags: pulumi.StringMap{
"Name": pulumi.String(name),
},
})
and now I want to get the subnetsids (i know they don't exit yet, and this is the problem)
I basically want to use to create a eks nodeGroup, from the example: https://github.com/pulumi/examples/blob/master/aws-go-eks/main.go
I have the code bellow, but it gets the vpc and subnets id using a lookup that i can't do because the vpc is yet to exit
nodeGroup, err := eks.NewNodeGroup(ctx, "node-group-2", &eks.NodeGroupArgs{
ClusterName: eksCluster.Name,
NodeGroupName: pulumi.String("demo-eks-nodegroup-2"),
NodeRoleArn: pulumi.StringInput(nodeGroupRole.Arn),
SubnetIds: toPulumiStringArray(subnet.Ids),
ScalingConfig: &eks.NodeGroupScalingConfigArgs{
DesiredSize: <http://pulumi.Int|pulumi.Int>(2),
MaxSize: <http://pulumi.Int|pulumi.Int>(2),
MinSize: <http://pulumi.Int|pulumi.Int>(1),
},
})
I tried to use LookupVpcOutput
but wasn't able to get it working, mostly because of types and etc..
Does anyone have any suggestions? if i should use the lookup or something else.. if it's the lookup, some example would be nice, i had problems getting the filter to work.
Basically i want to be able to create my own vpc, and then make eks and etc use this vpc, it seems it should be a simple thing, but i guess i am not getting the right idea on inputs/outputsfancy-crayon-34226
04/12/2023, 10:53 PMpulumi.String(`
{
"LocalSecondaryIndexes": [
{
"IndexName": "domainID",
"KeySchema": [
{
"AttributeName": "domainID",
"KeyType": "HASH",
"AttributeType": "S"
},
{
"AttributeName": "timestamp",
"KeyType": "RANGE",
"AttributeType": "N"
}
],
"Projection": {
"ProjectionType": "ALL"
}
}
]
}`)
when preview
LocalSecondaryIndexes: (json) {
LocalSecondaryIndexes: [
[0]: {
IndexName : "domainID"
KeySchema : [
[0]: {
AttributeName: "domainID"
AttributeType: "S"
KeyType : "HASH"
}
[1]: {
AttributeName: "timestamp"
AttributeType: "N"
KeyType : "RANGE"
}
]
Projection: {
ProjectionType: "ALL"
}}]}
i would like to see plain string instead of jsonArray, how can i achieve it? Thanks in advance.bulky-agent-73210
04/13/2023, 1:19 PMgo.mod
file?bored-vr-79323
04/17/2023, 9:01 AM.Run
I’m using .RunErr
to get errors:
package main
import (
"<http://github.com/pulumi/pulumi-hcloud/sdk/go/hcloud|github.com/pulumi/pulumi-hcloud/sdk/go/hcloud>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
"log"
)
func main() {
err := pulumi.RunErr(func(ctx *pulumi.Context) error {
log.Println("Creating new network...")
network, err := hcloud.NewNetwork(ctx, "demo-network", &hcloud.NetworkArgs{
IpRange: pulumi.String("10.0.10.0/24"),
Name: pulumi.String("demo-project"),
})
if err != nil {
return err
}
ctx.Export("networkName", network.Name)
return nil
})
if err != nil {
log.Fatal("Error creating network: ", err)
}
}
When I build and run the binary, I get an error: missing project name
. Where does the project name go? Don’t I already give it a project name “demo-network”? The docs call that parameter a “unique name”. So I’m not sure.gifted-fall-44000
04/18/2023, 5:01 AMhelm.NewChart(ctx, "cilium", helm.ChartArgs{
Namespace: pulumi.String("kube-system"),
FetchArgs: helm.FetchArgs{
Version: pulumi.String("1.13.1"),
Repo: pulumi.String("<https://helm.cilium.io/>"),
},
Chart: pulumi.String("cilium"),
Version: pulumi.String("1.13.1"),
Values: pulumi.Map{
"eni": pulumi.Map{
"enabled": pulumi.Bool(true),
},
"ipam": pulumi.Map{
"mode": pulumi.String("eni"),
},
"egressMasqueradeInterfaces": pulumi.String("eth0"),
"tunnel": pulumi.String("disabled"),
},
}, pulumi.Provider(provider), pulumi.DependsOn([]pulumi.Resource{infrastructure.Cluster.Cluster}))
bored-vr-79323
04/18/2023, 3:01 PMbrash-painting-89833
04/19/2023, 5:58 AM./main.go:15:20: cannot use pulumi.NewFileAsset("./metrics.yml") (value of type pulumi.Asset) as pulumi.AssetOrArchiveArrayInput value in struct literal: pulumi.Asset does not implement pulumi.AssetOrArchiveArrayInput (missing method ToAssetOrArchiveArrayOutput)
any tips?