salmon-account-74572
07/17/2020, 2:17 PMsalmon-account-74572
07/17/2020, 4:46 PMctx.Export("privSubnetIds", pulumi.StringArray(privSubnetIds))
In another stack that builds on top of that infrastructure stack, I reference the array like this:
infra, err := pulumi.NewStackReference(ctx, "org/project/stack", nil)
privSubnets := infra.GetOutput(pulumi.StringArray("privSubnetIds))
I haven't tried to run this yet, because gopls
inside VS Code is showing errors on the privSubnets
assignment line & when I try to reference that value inside an ec2.NewInstance
stanza. I think the error is in the assignment line, but I'm not quite sure how it needs to be changed to work. Any suggestions?silly-byte-26835
07/18/2020, 5:38 AMsalmon-account-74572
07/22/2020, 5:15 PMApplyStringArray
and ApplyString
functions to the outputs from the stack reference, but trying to create an instance using a security group and subnet from the stack reference fails. I guess it's defaulting to the first subnet in the default VPC and not using my subnet at all. Code in thread below.bright-ghost-66126
07/27/2020, 8:49 PMresource "okta_policy_mfa" "blue-ocean" {
name = "Blue Ocean"
status = "ACTIVE"
description = "Blue Ocean"
groups_included = ["abc"]
priority = okta_policy_mfa.svc.priority + 1
}
resource "okta_policy_mfa" "svc" {
name = "Service Accounts"
status = "ACTIVE"
description = ""
groups_included = ["abc"]
priority = 1
}
looks like this
import (
"<http://github.com/pulumi/pulumi-okta/sdk/v2/go/okta/policy|github.com/pulumi/pulumi-okta/sdk/v2/go/okta/policy>"
"<http://github.com/pulumi/pulumi/sdk/v2/go/pulumi|github.com/pulumi/pulumi/sdk/v2/go/pulumi>"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
svc, err := policy.NewMfa(ctx, "svc", &policy.MfaArgs{
Name: pulumi.String("Service Accounts"),
Status: pulumi.String("ACTIVE"),
Description: pulumi.String(""),
GroupsIncludeds: pulumi.StringArray{
pulumi.String("abc"),
},
Priority: <http://pulumi.Int|pulumi.Int>(1),
})
if err != nil {
return err
}
_, err = policy.NewMfa(ctx, "blue_ocean", &policy.MfaArgs{
Name: pulumi.String("Blue Ocean"),
Status: pulumi.String("ACTIVE"),
Description: pulumi.String("Blue Ocean"),
GroupsIncludeds: pulumi.StringArray{
pulumi.String("abc"),
},
Priority: <http://pulumi.Int|pulumi.Int>(svc.Priority.ApplyT(func(priority int) (float64, error) {
return priority + 1, nil
}).(pulumi.Float64Output)),
})
if err != nil {
return err
}
return nil
})
}
running this code results in this
pulumi_okta [pulumi_okta.test]
/Users/jjayaweera/go/src/pulumi_okta/some_test.go:143:24: cannot convert svc.Priority.OutputState.ApplyT(func literal).(pulumi.Float64Output) (type pulumi.Float64Output) to type <http://pulumi.Int|pulumi.Int>
/Users/jjayaweera/go/src/pulumi_okta/some_test.go:144:21: cannot use priority + 1 (type int) as type float64 in return argument
FAIL pulumi_okta [build failed]
FAIL
What is the correct syntax for this
Priority: <http://pulumi.Int|pulumi.Int>(svc.Priority.ApplyT(func(priority int) (float64, error) {
return priority + 1, nil
}).(pulumi.Float64Output)),
salmon-account-74572
07/28/2020, 2:31 AMazNames := make([]string, numOfAZs)
for idx := 0; idx < numOfAZs; idx++ {
azNames[idx] = rawAzInfo.Names[idx]
}
where rawAzInfo
is the result of the aws.GetAvailabilityZones
resource, how can I use that array as an input to the AvailabilityZones argument of the elb.NewLoadBalancer
resource?
Alternately, if I have an array of instance IDs, how could I use that array of instance IDs as an input to the Instances argument of the elb.NewLoadBalancer
resource?important-appointment-55126
07/28/2020, 6:49 PMpulumi.MapInput
to a pulumi.StringMapInput
forcing me to refactor my code.. not huge, but an unexpected breaking change for a point releasesalmon-account-74572
07/29/2020, 2:42 PMimportant-appointment-55126
07/29/2020, 3:39 PMconst certificateValidationDomain = new aws.route53.Record(`${config.targetDomain}-validation`, {
name: certificate.domainValidationOptions[0].resourceRecordName,
zoneId: hostedZoneId,
type: certificate.domainValidationOptions[0].resourceRecordType,
records: [certificate.domainValidationOptions[0].resourceRecordValue],
ttl: tenMinutes,
});
important-appointment-55126
07/29/2020, 3:39 PMcertValidationDomain, err := route53.NewRecord(ctx, domain+"-validation", &route53.RecordArgs{
Name: cert.DomainValidationOptions.Index(<http://pulumi.Int|pulumi.Int>(0)).ResourceRecordName(),
Type: cert.DomainValidationOptions.Index(<http://pulumi.Int|pulumi.Int>(0)).ResourceRecordType(),
Records: pulumi.StringArray{cert.DomainValidationOptions.Index(<http://pulumi.Int|pulumi.Int>(0)).ResourceRecordValue()},
ZoneId: zone.ID(),
Ttl: <http://pulumi.Int|pulumi.Int>(600),
})
important-appointment-55126
07/29/2020, 3:39 PM/main.go:87:4: cannot use cert.DomainValidationOptions.Index(<http://pulumi.Int|pulumi.Int>(0)).ResourceRecordName() (type pulumi.StringPtrOutput) as type pulumi.StringInput in field value:
pulumi.StringPtrOutput does not implement pulumi.StringInput (missing ToStringOutput method)
important-appointment-55126
07/29/2020, 3:40 PMApplyT
but feels like it shouldn’t be necessaryorange-electrician-25669
08/08/2020, 8:29 PMtype (
S1LBConfig struct {
LoadBalancer struct {
Rules []struct {
Lb struct {
SecurityGroups []string
Subnets []string
}
}
}
}
)
SecurityGroups: pulumi.StringArray{pulumi.String(s1LoadBalancerConfig.LoadBalancer.Rules[k].Lb.SecurityGroups)},
Cannot convert expression of type '[]string' to type 'String'
green-intern-96475
08/11/2020, 2:27 PMurl := vpc.DnsName.ApplyString(func(dnsName string) string {
return "https://" + dnsName
})
Thank youmicroscopic-flower-40914
08/11/2020, 2:39 PMmicroscopic-flower-40914
08/12/2020, 6:14 AMchilly-rainbow-79265
08/20/2020, 7:14 AMconfig:
vm:instance_spec:
- count: 1
data_disk_size: 50
name: cassandra
resource_group: pu_demo
type: Standard_A8_v2
user_name: deployer
main.go
// vm config struct
type Data struct {
Data []struct {
Name string `json:"name"`
Type string `json:"type"`
Count int `json:"count"`
DataDiskSize int `json:"data_disk_size"`
UserName string `json:"user_name"`
ResourceGroupName string `json:"resource_group"`
} `json:"instance_spec"`
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
vmConfig := config.New(ctx, "vm")
var d Data
if err := vmConfig.GetObject("instance_spec", &d); err != nil {
return err
})
fmt.Printf("%v\n", d)
return nil
)}
}
and I'm getting this error
Diagnostics:
pulumi:pulumi:Stack (demo-dev):
error: program failed: 1 error occurred:
* json: cannot unmarshal array into Go value of type main.Data
exit status 1
error: an unhandled error occurred: program exited with non-zero exit code: 1
gifted-city-99717
08/23/2020, 2:28 PMec2.GetSubnetIds()
? Maybe testing these failure scenarios is only really possible using something like the integration testing utilities?hallowed-beach-15050
08/27/2020, 2:27 AMhallowed-beach-15050
08/27/2020, 2:28 AMhallowed-beach-15050
08/27/2020, 2:28 AMred-area-47037
08/27/2020, 9:24 PMimportant-appointment-55126
08/27/2020, 9:38 PMred-area-47037
08/28/2020, 8:34 AMimportant-appointment-55126
08/28/2020, 2:08 PMwet-egg-6347
08/28/2020, 7:47 PMpulumi.NewStackReference(...).GetProvider("pg-provider-id")
however, the consumer stack also needs raw connection info (host, port, etc) in order to inject that info into kubernetes pods, so that the pods can connect to pg at runtime. this is where it gets tricky...
• is there some way to get postgresql.ProviderArgs
out of the provider, during pulumi runtime?
• is there some easy way to marshal/unmarshal postgresql.ProviderArgs
, so that i can use a string stack export? keep in mind there are no pulumi types (input/output) defined for postgresql.ProviderArgs
-- that's just a struct containing a bunch of pulumi types
tia 🙏red-area-47037
08/29/2020, 3:31 PMred-area-47037
08/29/2020, 5:58 PMorange-electrician-25669
08/31/2020, 10:33 AMechoing-rain-5741
08/31/2020, 11:43 AMname: Pulumi
on:
- pull_request
jobs:
preview:
name: Preview
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: preview
uses: <docker://pulumi/actions>
with:
args: preview
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CI: pr
PULUMI_ROOT: infra/cluster/processing
This is the output from the preview step:
Run <docker://pulumi/actions>
10 /usr/bin/docker run --name pulumiactions_99916e --label 3b3ac6 --workdir /github/workspace --rm -e GOOGLE_CREDENTIALS -e PULUMI_ACCESS_TOKEN -e PULUMI_CI -e PULUMI_ROOT -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/xxx/xxx":"/github/workspace" pulumi/actions preview
11 Logging in using access token from PULUMI_ACCESS_TOKEN
12 Logged in to <http://pulumi.com|pulumi.com> as xxx (<https://app.pulumi.com/> xxx)
13 Activated service account credentials for: [<mailto:pulumi-github-workflows-cicd@xxx.iam.gserviceaccount.com|pulumi-github-workflows-cicd@xxx.iam.gserviceaccount.com>]
14 Adding credentials for all GCR repositories.
15 WARNING: A long list of credential helpers may cause delays running 'docker build'. We recommend passing the registry name to configure only the registry you are using.
16 Docker configuration file updated.
`17 #### 🍹 `pulumi --non-interactive preview``
18 Previewing update (yyy/xxx):
19 [resource plugin kubernetes-2.3.0] installing
20
21 Downloading plugin: 0 B / 21.46 MiB 0.00%
22 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00%
23 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00%
24 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00%
25 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00% 0s
26 Moving plugin... done.
27
28 Permalink: <https://app.pulumi.com/xxx/previews/0472bcb1-a637-4708-96e9-21f0fe9862ff>
29 error: could not load plugin for gcp provider 'urn:pulumi:xxx::cadence::pulumi:providers:gcp::gcp-provider': no resource plugin 'gcp' found in the workspace or on your $PATH
Thanks in advance for any help.echoing-rain-5741
08/31/2020, 11:43 AMname: Pulumi
on:
- pull_request
jobs:
preview:
name: Preview
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: preview
uses: <docker://pulumi/actions>
with:
args: preview
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CI: pr
PULUMI_ROOT: infra/cluster/processing
This is the output from the preview step:
Run <docker://pulumi/actions>
10 /usr/bin/docker run --name pulumiactions_99916e --label 3b3ac6 --workdir /github/workspace --rm -e GOOGLE_CREDENTIALS -e PULUMI_ACCESS_TOKEN -e PULUMI_CI -e PULUMI_ROOT -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/xxx/xxx":"/github/workspace" pulumi/actions preview
11 Logging in using access token from PULUMI_ACCESS_TOKEN
12 Logged in to <http://pulumi.com|pulumi.com> as xxx (<https://app.pulumi.com/> xxx)
13 Activated service account credentials for: [<mailto:pulumi-github-workflows-cicd@xxx.iam.gserviceaccount.com|pulumi-github-workflows-cicd@xxx.iam.gserviceaccount.com>]
14 Adding credentials for all GCR repositories.
15 WARNING: A long list of credential helpers may cause delays running 'docker build'. We recommend passing the registry name to configure only the registry you are using.
16 Docker configuration file updated.
`17 #### 🍹 `pulumi --non-interactive preview``
18 Previewing update (yyy/xxx):
19 [resource plugin kubernetes-2.3.0] installing
20
21 Downloading plugin: 0 B / 21.46 MiB 0.00%
22 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00%
23 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00%
24 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00%
25 Downloading plugin: 21.46 MiB / 21.46 MiB 100.00% 0s
26 Moving plugin... done.
27
28 Permalink: <https://app.pulumi.com/xxx/previews/0472bcb1-a637-4708-96e9-21f0fe9862ff>
29 error: could not load plugin for gcp provider 'urn:pulumi:xxx::cadence::pulumi:providers:gcp::gcp-provider': no resource plugin 'gcp' found in the workspace or on your $PATH
Thanks in advance for any help.lemon-agent-27707
08/31/2020, 3:17 PMpulumi plugin install resource gcp vX.X.X
echoing-rain-5741
08/31/2020, 3:47 PMlemon-agent-27707
08/31/2020, 4:20 PMpulumi/actions preview
Can you first run a pulumi/actions plugin install resource gcp v3.21.1
?echoing-rain-5741
09/01/2020, 7:20 AM- name: install-gcp-plugin
uses: <docker://pulumi/actions>
with:
args: plugin install resource gcp v3.21.1
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CI: pr
PULUMI_ROOT: infra/cluster/processing
before the preview step. It installs the plugin successfully, but the preview command still fails with the same error message.