https://pulumi.com logo
#aws
Title
# aws
b

big-potato-91793

02/09/2021, 3:55 PM
I’m trying to create a basic ALB with a ASG for some web instances… Always getting that error
Copy code
aws:autoscaling:Group (resource1):
    error: aws:autoscaling/group:Group resource 'resource1' has a problem: Attribute should be a list
Copy code
Error: invocation of aws:ec2/getVpc:getVpc returned an error: transport is closing
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/invoke.js:139:33
        at Http2CallStream.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/client.ts:155:9)
        at Http2CallStream.emit (events.js:228:7)
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/call-stream.ts:186:14
        at processTicksAndRejections (internal/process/task_queues.js:76:11)
    Error: invocation of aws:ec2/getVpc:getVpc returned an error: transport is closing
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/invoke.js:139:33
        at Http2CallStream.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/client.ts:155:9)
        at Http2CallStream.emit (events.js:228:7)
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/call-stream.ts:186:14
        at processTicksAndRejections (internal/process/task_queues.js:76:11)
    Error: invocation of aws:ec2/getVpc:getVpc returned an error: transport is closing
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/invoke.js:139:33
        at Http2CallStream.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/client.ts:155:9)
        at Http2CallStream.emit (events.js:228:7)
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/call-stream.ts:186:14
        at processTicksAndRejections (internal/process/task_queues.js:76:11)
 
    unhandled rejection: CONTEXT(1162): resource:prd2697-nonprod-tm1-gateway-ec2-deployment[aws:lb/loadBalancer:LoadBalancer]
    STACK_TRACE:
    Error:
        at Object.debuggablePromise (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/debuggable.js:69:75)
        at Object.registerResource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/resource.js:219:18)
        at new Resource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/resource.js:215:24)
        at new CustomResource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/resource.js:307:9)
        at new LoadBalancer (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/lb/loadBalancer.ts:284:9)
        at Object.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/aws.ts:91:13)
        at Module._compile (internal/modules/cjs/loader.js:955:30)
        at Module.m._compile (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/ts-node/src/index.ts:439:23)
        at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
        at Object.require.extensions.<computed> [as .ts] (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/ts-node/src/index.ts:442:12)
    unhandled rejection: CONTEXT(1162): resource:prd2697-nonprod-tm1-gateway-ec2-deployment[aws:lb/loadBalancer:LoadBalancer]
    STACK_TRACE:
    Error:
        at Object.debuggablePromise (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/debuggable.js:69:75)
        at Object.registerResource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/resource.js:219:18)
        at new Resource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/resource.js:215:24)
        at new CustomResource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/resource.js:307:9)
        at new LoadBalancer (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/lb/loadBalancer.ts:284:9)
        at Object.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/aws.ts:91:13)
        at Module._compile (internal/modules/cjs/loader.js:955:30)
        at Module.m._compile (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/ts-node/src/index.ts:439:23)
        at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
        at Object.require.extensions.<computed> [as .ts] (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/ts-node/src/index.ts:442:12)
    unhandled rejection: CONTEXT(1162): resource:prd2697-nonprod-tm1-gateway-ec2-deployment[aws:lb/loadBalancer:LoadBalancer]
    STACK_TRACE:
    Error:
        at Object.debuggablePromise (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/debuggable.js:69:75)
        at Object.registerResource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/resource.js:219:18)
        at new Resource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/resource.js:215:24)
        at new CustomResource (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/resource.js:307:9)
        at new LoadBalancer (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/lb/loadBalancer.ts:284:9)
        at Object.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/aws.ts:91:13)
        at Module._compile (internal/modules/cjs/loader.js:955:30)
        at Module.m._compile (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/ts-node/src/index.ts:439:23)
        at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
        at Object.require.extensions.<computed> [as .ts] (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/ts-node/src/index.ts:442:12)
 
    error: Running program '/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws' failed with an unhandled exception:
    Error: invocation of aws:ec2/getVpc:getVpc returned an error: transport is closing
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@pulumi/pulumi/runtime/invoke.js:139:33
        at Http2CallStream.<anonymous> (/Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/client.ts:155:9)
        at Http2CallStream.emit (events.js:228:7)
        at /Users/Alexandre.Lemieux/tm/tm1/gateway/pulumi/aws/node_modules/@grpc/grpc-js/src/call-stream.ts:186:14
        at processTicksAndRejections (internal/process/task_queues.js:76:11)
b

brief-printer-34348

02/09/2021, 4:06 PM
You’ve got your regions and everything set correctly?
Can you list using the AWS cli using your Service Account credentials?
b

big-potato-91793

02/09/2021, 4:10 PM
Suppose to be.
I’m trying to deploy in eu-central-1 region
Copy code
env | grep "AWS"                                                                                                                                                       <aws:tm-nonprod-prd198-Ops-Techops>
AWS_PROFILE=tm-nonprod-prd198-Ops-Techops
AWS_REGION=eu-central-1
@brief-printer-34348 you want me to try which command?
b

billowy-army-68599

02/09/2021, 4:15 PM
can you share the code you're using?
b

brief-printer-34348

02/09/2021, 4:15 PM
Probably
aws describe-vpcs
b

big-potato-91793

02/09/2021, 4:20 PM
aws ec2 describe-vpcs
this one works
@billowy-army-68599 will share that after lunchtime
@billowy-army-68599 Do you have a preferable way to share this?
Copy code
const assumeRolePolicy = aws.iam.getPolicyDocument({
    statements: [{
        actions: ['sts:AssumeRole'],
        principals: [{
            type: 'Service',
            identifiers: ['<http://ec2.amazonaws.com|ec2.amazonaws.com>'],
        }],
        effect: 'Allow',
    }],
});

const iamRole = new aws.iam.Role(awsResourceName, {
    assumeRolePolicy: assumeRolePolicy.then(policy => policy.json),
    permissionsBoundary: permissionBoundaryName,
});

const instanceProfile = new aws.iam.InstanceProfile(awsResourceName, {
    role: iamRole,
});

const launchConfiguration = new aws.ec2.LaunchConfiguration(awsResourceName, {
    namePrefix: `${awsResourceName}.app-`,
    imageId: iamByRegion[config.region],
    instanceType: config.instanceType,
    securityGroups: selectedSecurityGroup.ids,
    userData: getUserData(),
    keyName: sshKeyName,
    enableMonitoring: config.enableMonitoring,
    iamInstanceProfile: instanceProfile,
});

const targetGroup = new aws.alb.TargetGroup(awsResourceName, {
    namePrefix: 'tm1g-',
    port: 8080,
    protocol: 'HTTP',
    vpcId: selectedVpc.id.apply(id => id),
    deregistrationDelay: 90,
    healthCheck: {
        interval: 5,
        path: '/actuator/health',
        port: '9100',
        protocol: 'HTTP',
        timeout: 3,
        healthyThreshold: 2,
        unhealthyThreshold: 3,
    },
});

const asg = new aws.autoscaling.Group(awsResourceName, {
    minSize: config.minAvailable,
    maxSize: config.replicas,
    desiredCapacity: config.replicas,
    forceDelete: true,
    launchConfiguration: launchConfiguration,
    targetGroupArns: [targetGroup.arn],
    vpcZoneIdentifiers: ['subnet-085096f399a4bccd8', 'subnet-6276db0a', 'subnet-cb34c7b1'],
    // terminationPolicies: ['OldestLaunchConfiguration'],
    terminationPolicies: [],
    waitForCapacityTimeout: '20m',
    waitForElbCapacity: 1,
    healthCheckGracePeriod: 600,
    healthCheckType: 'ELB',

});

const alb = new aws.lb.LoadBalancer(awsResourceName, {
    internal: config.albInternal,
    loadBalancerType: aws.alb.LoadBalancerType.Application,
    securityGroups: selectedSecurityGroup.ids,
    subnets: selectedSubnetIds.ids,

});

const httpListener = new aws.alb.Listener(awsResourceName, {
    loadBalancerArn: alb.arn.apply(arn => arn),
    port: 80,
    protocol: 'HTTP',
    defaultActions: [
        {
            targetGroupArn: targetGroup.arn.apply(arn => arn),
            type: 'forward',
        },
    ],
});
If found the problem.
It was related to the
autotag
transformation that we adapted from @big-piano-35669 on github.
This one doesn’t work for the tags objects in the AutoscalingGroup.
This one want to have a
GroupTag[]
instead of a
Record<string,string>
7 Views