https://pulumi.com logo
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
golang
  • c

    cold-car-23440

    09/18/2019, 8:33 AM
    awesome - i take it i just need to watch the github repositories for new releases?
  • b

    broad-dog-22463

    09/18/2019, 8:34 AM
    yessir
  • c

    cold-car-23440

    09/18/2019, 8:34 AM
    brill - thanks for the update. saved me a lot of time getting lost in the rabbit hole
  • c

    cold-car-23440

    09/18/2019, 10:07 AM
    I can confirm all is good using go 1.12.9. if anyone else gets stuck with this, run the following
    go get <http://golang.org/dl/go1.12.9|golang.org/dl/go1.12.9>
    go1.12.9 download
    
    go1.12.9 build
  • b

    broad-dog-22463

    09/18/2019, 12:23 PM
    👍
  • c

    cold-car-23440

    09/24/2019, 7:34 AM
    Morning gophers - in Terraform, there is a count argument which allows you to create multiple instances of a resource. How can i achieve this with pulumi using Go?
  • b

    broad-dog-22463

    09/24/2019, 8:39 AM
    @cold-car-23440 you can use a loop to do the same thing
  • b

    broad-dog-22463

    09/24/2019, 8:40 AM
    that's what it is was created in place of in Terraform
    👍 1
    • 1
    • 1
  • s

    stocky-spoon-28903

    09/24/2019, 8:44 AM
    Remember you do need to make the names of each resource unique - so you probably want to assign them as being
    fmt.Sprintf("base-name-%d", i)
    where
    i
    is your loop enumerator
    👍 1
  • c

    cold-car-23440

    09/24/2019, 9:23 AM
    thanks @broad-dog-22463 & @stocky-spoon-28903
  • c

    cold-car-23440

    09/24/2019, 9:26 AM
    I just realised @stocky-spoon-28903 gave the cloud init talk at hashiconf eu this year 👏👏👏👏
    s
    • 2
    • 2
  • c

    cold-car-23440

    09/24/2019, 4:45 PM
    newbie issue here. I’m trying to create multiple NICs in azure below is my code snippet:
    var consulcount [5]int
    
    		for i := range consulcount {
    			consulnicename := fmt.Sprintf("consul-nic-%d", i+0)
    			ipConfig := map[string]interface{}{
    				"subnetid":                  vaultSubnet.ID(),
    				"name":                      fmt.Sprintf("consul-nic-ipc-%d", i+0),
    				"PrivateIPAllocationMethod": "Dynamic",
    			}
    			consulNics, err := network.NewNetworkInterface(ctx, consulnicename, &network.NetworkInterfaceArgs{
    				Name:              consulnicename,
    				ResourceGroupName: resourceGroup.Name(),
    				Location:          location,
    				IpConfigurations:  ipConfig,
    			})
    			if err != nil {
    				return err
    			}
    			ctx.Export("nic-name", consulNics.Name())
    
    		}
    I’m getting the following error
    error: azure:network/networkInterface:NetworkInterface resource 'consul-nic-3' has a problem: ip_configuration: should be a list
    not quite sure how to present these params as a list as IpConfigurations is sort of a nested block in terraform terms any pointers would be greatly appreciated
  • s

    stocky-spoon-28903

    09/24/2019, 5:08 PM
    @cold-car-23440 Do this for
    IpConfigurations
    assignment:
    IpConfigurations: []interface{}{ipConfig},
    👍 1
  • c

    cold-car-23440

    09/24/2019, 5:10 PM
    Thanks @stocky-spoon-28903 solved my issue
  • s

    stocky-spoon-28903

    09/24/2019, 5:10 PM
    Unfortunately the type system of Go is not especially helpful here
  • c

    cold-car-23440

    09/24/2019, 5:11 PM
    yea i know what you mean!
  • c

    cold-car-23440

    09/25/2019, 7:43 AM
    Can I build in resource dependancy?
  • s

    stocky-spoon-28903

    09/25/2019, 7:43 AM
    Yes, in the resource options
  • s

    stocky-spoon-28903

    09/25/2019, 7:44 AM
    https://github.com/pulumi/pulumi/blob/master/sdk/go/pulumi/resource.go#L54-L72
  • c

    cold-car-23440

    09/25/2019, 7:45 AM
    Awesome - is there any documentation about this that I can refer to?
  • c

    cold-car-23440

    09/25/2019, 7:45 AM
    Nice - thanks once again @stocky-spoon-28903
  • c

    cold-car-23440

    09/25/2019, 7:48 AM
    This may be a little tricky if the resource being depended on is described inside a loop as the variable scope will not be accessible from the new resource that relies on it
  • s

    stocky-spoon-28903

    09/25/2019, 9:36 AM
    Collect them outside the loop?
  • s

    stocky-spoon-28903

    09/25/2019, 9:37 AM
    var things []Thing
    
    for _, _ := range things_to_make {
        things = append(things, NewThing(...))
    }
    
    NewY(..., ResourceOpts{ DependsOn = things })
  • s

    stocky-spoon-28903

    09/25/2019, 9:37 AM
    Something like that
  • c

    cold-car-23440

    09/25/2019, 10:02 AM
    funny that, was just talking to my colleague and he suggested the same thing @stocky-spoon-28903
  • b

    broad-dog-22463

    09/25/2019, 10:04 AM
    I think that dependsOn is []string of IDs
  • b

    broad-dog-22463

    09/25/2019, 10:04 AM
    so hsould be easy enough
  • c

    cold-car-23440

    09/25/2019, 10:05 AM
    yea it is. Thanks @broad-dog-22463
  • s

    stocky-spoon-28903

    09/25/2019, 10:51 AM
    Ah yes - substitute the array for []ResourceId then instead
Powered by Linen
Title
s

stocky-spoon-28903

09/25/2019, 10:51 AM
Ah yes - substitute the array for []ResourceId then instead
View count: 3