salmon-ghost-86211
03/24/2021, 4:15 PMconst iamGroup = pulumi.output(aws.iam.getGroup({
groupName: "myGroup",
}, { async: true }));
const usernames = iamGroup.apply(group => group.users.map(user => user.userName));
If I export
const usernames, I see
Outputs:
usernames: [
[0]: "username1"
[1]: "username2"
[2]: "username3"
]
However, later when attempting to use both .filter
and .map
on the usernames
list, I get
TSError: ⨯ Unable to compile TypeScript:
index.ts(312,13): error TS2488: Type 'Output<string[]>' must have a '[Symbol.iterator]()' method that returns an iterator.
index.ts(469,42): error TS2339: Property 'map' does not exist on type 'Output<string[]>'.
I have tried many variations of .apply
but am so far unable to use the above methods or return this list from the function it is in. I have read the Inputs and Outputs doc many times but it is still painful to figure out how to make it work.microscopic-dress-1605
03/24/2021, 5:22 PMaws-resource
for creating AWS resources. The package aws-resource
is used inside a Pulumi stack.
When I execute the unit tests of the Pulumi stack, it complains with ‘_Error: Program run without the Pulumi engine available; re-run using the pulumi
CLI_’. Although the unit tests of the stack contain the mocking code for Pulumi resources.
pulumi.runtime.setMocks({
newResource: function(...) { ... }
});
I guess the pulumi API calls inside the Nodejs package aws-resource
don’t get mocked.
What should I do to also have the resources created by the package aws-resource
mocked?better-shampoo-48884
03/27/2021, 12:07 PMbetter-shampoo-48884
03/27/2021, 12:10 PMmysterious-wolf-74677
03/30/2021, 3:31 PMpulumi import
without updating state possibly?little-cartoon-10569
03/30/2021, 10:06 PMgifted-island-55702
04/02/2021, 10:18 AMconst promise = new Promise<Map<string, string>>((resolve, reject) => new Map<string, string>());
const output: pulumi.Output<Map<string, string>> = pulumi.output(promise);
as it fails with:
TS2322: Type 'Output<UnwrappedObject<Map<string, string>>>' is not assignable to type 'Output<Map<string, string>>'. Type 'Output<UnwrappedObject<Map<string, string>>>' is not assignable to type 'OutputInstance<Map<string, string>>'. Types of property 'apply' are incompatible. Type '{ <U>(func: (t: UnwrappedObject<Map<string, string>>) => Promise<U>): Output<U>; <U>(func: (t: UnwrappedObject<Map<string, string>>) => OutputInstance<...>): Output<...>; <U>(func: (t: UnwrappedObject<...>) => U): Output<...>; }' is not assignable to type '{ <U>(func: (t: Map<string, string>) => Promise<U>): Output<U>; <U>(func: (t: Map<string, string>) => OutputInstance<U>): Output<U>; <U>(func: (t: Map<...>) => U): Output<...>; }'. Types of parameters 'func' and 'func' are incompatible. Types of parameters 't' and 't' are incompatible. Type 'UnwrappedObject<Map<string, string>>' is missing the following properties from type 'Map<string, string>': [Symbol.iterator], [Symbol.toStringTag]
Am I missing something? I thought that I can "repackage" whatever I have in the promise object into an output object.gifted-island-55702
04/09/2021, 12:01 PMgifted-island-55702
04/09/2021, 12:01 PMacceptable-army-69872
04/09/2021, 8:59 PMis:issue waf is:closed
is 1 issue.mysterious-oyster-86659
04/12/2021, 5:01 PMstocky-address-37940
04/12/2021, 6:52 PMstocky-address-37940
04/12/2021, 6:52 PMpurple-train-14007
04/13/2021, 9:47 PMpurple-train-14007
04/13/2021, 10:26 PMalert-oyster-87530
04/13/2021, 11:36 PMpurple-train-14007
04/14/2021, 1:41 AMpurple-train-14007
04/14/2021, 1:41 AMprehistoric-ocean-52185
04/14/2021, 5:27 AMcuddly-dusk-95227
04/14/2021, 11:36 AMpulumi-eks
. what am I missing?purple-train-14007
04/15/2021, 6:05 PMconst USNetWork = new azure_native.network.VirtualNetwork(usNetName, {
resourceGroupName: RG,
location: "WestUS",
virtualNetworkName: usNetName,
addressSpace: {
addressPrefixes: [usAddr],
},
});
const domainSubnetUSA = new azure_native.network.Subnet(usADDSSubnetName, {
resourceGroupName: RG,
subnetName: usADDSSubnetName,
virtualNetworkName: USNetWork.name,
addressPrefix: usADDSSubnetaddr,
});
const meshSubnetUSA = new azure_native.network.Subnet(usMESHSubnetName, {
resourceGroupName: RG,
subnetName: usMESHSubnetName,
virtualNetworkName: USNetWork.name,
addressPrefix: usMESHSubnetaddr,
});
const InboundSGUSA = new azure_native.network.NetworkSecurityGroup("InboundSG", {
location: "WestUS",
networkSecurityGroupName: "Test",
resourceGroupName: RG,
securityRules: [allowPSRM,allowRDP],
});
worried-queen-62794
04/18/2021, 9:41 AMOutputInstance
defines these:
apply<U>(func: (t: T) => Promise<U>): Output<U>;
apply<U>(func: (t: T) => OutputInstance<U>): Output<U>;
apply<U>(func: (t: T) => U): Output<U>;
Shouldn't they be?
apply<U>(func: (t: T) => Promise<U> | OutputInstance<U> | U): Output<U>;
Otherwise if func
is something like string => number | Promise<number>
then it returns Output<number | Promise<number>>
rather than Output<number>
. Unless that was intentional?melodic-easter-82419
04/20/2021, 7:35 PMmelodic-easter-82419
04/20/2021, 8:38 PMcolossal-australia-65039
04/20/2021, 11:20 PM$ pulumi up
Previewing update (eks-dev):
[resource plugin kubernetes-2.8.2] installing
Downloading plugin: 0 B / 28.83 MiB [----------------------------------] 0.00%[resource plugin aws-3.31.0] installing
Downloading plugin: 28.83 MiB / 28.83 MiB [=========================] 100.00% 2s
Downloading plugin: 74.84 MiB / 74.84 MiB [=========================] 100.00% 4s
Type Name Plan Info
pulumi:pulumi:Stack infrastructure-eks-dev
└─ pulumi:providers:eks default 1 error
Diagnostics:
pulumi:providers:eks (default):
error: no resource plugin 'eks' found in the workspace or on your $PATH
elegant-pager-5412
04/22/2021, 5:11 AMtarget
I can use? Currently the default seems to be es2016
. Is there any reason why won’t I bump it to es2020
?
Also, as for the module
definition, can I use ES2020
or ESNext
?elegant-pager-5412
04/22/2021, 5:41 AMlittle-cartoon-10569
04/27/2021, 12:38 AMunhandled rejection: CONTEXT(3262): transferDeps( ...
elegant-pager-5412
04/28/2021, 9:28 AMtarget: "es2020"
in our tsconfig.json
file? Why are we locked to es2016
?elegant-pager-5412
04/28/2021, 9:32 AMtarget: "es2020"
and compile the project myself, piping the output JS to Pulumi?elegant-pager-5412
04/28/2021, 9:32 AMtarget: "es2020"
and compile the project myself, piping the output JS to Pulumi?billowy-army-68599
04/28/2021, 2:50 PMPulumi.yaml
options
typescript: false
https://www.pulumi.com/docs/reference/pulumi-yaml/lemon-monkey-228
04/28/2021, 3:25 PMpulumi up
?name: creatio-sync
description: Creatio Sync
runtime: nodejs
options:
typescript: false
is my Pulumi.yaml
npx tsc index.ts
it compiles the index.js
pulumi up
still seems to be trying to use itpackage.json
or something too?runtime:
name: nodejs
options:
typescript: false
but still no dicebillowy-army-68599
04/28/2021, 3:33 PMpulumi up
seems to be trying to use it, do you mean your index.ts ?elegant-pager-5412
04/28/2021, 3:41 PMtsconfig.json
specifies that the output dir should be dist
which is ignored in .gitignore
. Then I needed to tell Pulumi to use the JS file, which we can do so by adding the main
property to the package.json
.
The thing is that unless we use amd
as the module
definition in tsconfig
, TSC cannot combine all files into a single index.js
file.
To solve this, I did some bash magic and created the following command:
"scripts": {
"deploy": "tsc && sed -i '' \"s#\\\"main\\\": \\\".*,#\\\"main\\\": \\\"$(find dist -name 'index.js' -print -maxdepth 3 -quit)\\\",#\" package.json && pulumi up"
},
lemon-monkey-228
04/28/2021, 3:41 PMelegant-pager-5412
04/28/2021, 3:41 PM{
"compilerOptions": {
"strict": true,
"outDir": "dist",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictPropertyInitialization": false,
"forceConsistentCasingInFileNames": true,
"removeComments": true
}
}
lemon-monkey-228
04/28/2021, 3:46 PMDiagnostics:
pulumi:pulumi:Stack (creatio-sync-production):
error: Running program '/Users/james/projects/creatio/creatio-sync/deploy' failed with an unhandled exception:
/Users/james/projects/creatio/creatio-sync/deploy/node_modules/@devops/pulumi-utils/index.ts:1
import * as fs from 'fs'
^^^^^^
SyntaxError: Cannot use import statement outside a module
npx tsc
if the settings were till wrong (feel free to correct me if I’m wrong)elegant-pager-5412
04/28/2021, 3:51 PMlemon-monkey-228
04/28/2021, 4:38 PM{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
}
}
{
"name": "creatio-sync",
"main": "bin/index.js",
"devDependencies": {
"@types/node": "^10.0.0"
},
"dependencies": {
"@devops/pulumi-utils": "^0.1.2",
"@pulumi/kubernetes": "^2.0.0",
"@pulumi/kubernetesx": "^0.1.1",
"@pulumi/pulumi": "^2.0.0"
}
}
tsc
call to the library too