Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign '{}' to 'aws:alb/ListenerDefaultAction:ListenerDefaultAction': type: Missing required property 'type' #525

Open
devopsmash opened this issue Nov 21, 2023 · 3 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@devopsmash
Copy link

devopsmash commented Nov 21, 2023

What happened?

I'm trying to create a new aws.alb.Listener in order to attach it to a new aws.alb.LoadBalancer and to reference the defaultActions to a new aws.lb.TargetGroup with this example (link) with YAML syntax and with the Pulumi Kubernetes Operator (link).

I was able to create the aws.alb.LoadBalancer & aws.lb.TargetGroup successfully, but when I tried to create the aws.alb.Listener and reference in the defaultActions (which is list of maps) the new targetGroupArn from my new aws.lb.TargetGroup I got the following error:

Warning  StackUpdateFailure   3s (x21 over 5h48m)  stack-controller  Failed to update Stack: failed to run update: exit status 255
code: 255
stdout: Updating (test-stack):
    pulumi:pulumi:Stack test-test-stack running
@ updating....
    pulumi:pulumi:Stack test-test-stack running ^[[31mError^[[0m: aws:alb/listener:Listener is not assignable from {defaultActions: List<{}>, loadBalancerArn: string, port: number, protocol: string}
    pulumi:pulumi:Stack test-test-stack running   on Pulumi.yaml line 79:
    pulumi:pulumi:Stack test-test-stack running   79:       ^[[1;4m- ^[[0m{}
    pulumi:pulumi:Stack test-test-stack running Cannot assign '{defaultActions: List<{}>, loadBalancerArn: string, port: number, protocol: string}' to 'aws:alb/listener:Listener':
    pulumi:pulumi:Stack test-test-stack running   defaultActions: Cannot assign 'List<{}>' to 'List<aws:alb/ListenerDefaultAction:ListenerDefaultAction>':
    pulumi:pulumi:Stack test-test-stack running     Cannot assign '{}' to 'aws:alb/ListenerDefaultAction:ListenerDefaultAction':
    pulumi:pulumi:Stack test-test-stack running       type: Missing required property 'type'
    pulumi:pulumi:Stack test-test-stack  7 messages
Diagnostics:
  pulumi:pulumi:Stack (test-test-stack):
    ^[[31mError^[[0m: aws:alb/listener:Listener is not assignable from {defaultActions: List<{}>, loadBalancerArn: string, port: number, protocol: string}
      on Pulumi.yaml line 79:
      79:       ^[[1;4m- ^[[0m{}
    Cannot assign '{defaultActions: List<{}>, loadBalancerArn: string, port: number, protocol: string}' to 'aws:alb/listener:Listener':
      defaultActions: Cannot assign 'List<{}>' to 'List<aws:alb/ListenerDefaultAction:ListenerDefaultAction>':
        Cannot assign '{}' to 'aws:alb/ListenerDefaultAction:ListenerDefaultAction':
          type: Missing required property 'type'

Example

apiVersion: pulumi.com/v1
kind: Program
metadata:
  name: test
program:
  variables:
    ProfileName: test-profile
    VPC: vpc-e4fb608f
  resources:
    alb:
      type: aws:alb:LoadBalancer
      properties:
        tags: 
          Name: test-lb
        name: testing
        subnets: 
          - subnet-eacf3697
          - subnet-939b18f8
    TG:
      type: aws:alb:TargetGroup
      properties:
        port: 80
        protocol: 'HTTP'
        vpcId: ${VPC} 

    testTargetGroupAttachment:
      type: aws:alb:TargetGroupAttachment
      properties:
        targetGroupArn: ${TG.arn}
        targetId: ${ec2.id}
        port: 80
      
    httpListener:
      type: aws:alb:Listener
      properties:
        loadBalancerArn: ${alb.arn}
        port: 80
        protocol: "HTTP"
        defaultActions: 
          - type: "forward"
            targetGroupArn: ${TG.arn}

Any chance that there is a problem when the pulumi k8s operator is trying to convert the list of maps with a variable inside?

Note:
This not happens when I'm trying to run it driectly in my laptop, apperntly it happens only in the k8s operator.

@devopsmash devopsmash added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 21, 2023
@mikhailshilkov
Copy link
Member

A similar standalone program seems to type-check correctly, so it does sound like an operator problem, potentially:

name: aws-yaml
runtime: yaml
variables:
    ProfileName: test-profile
    VPC: vpc-e4fb608f
resources:
  alb:
    type: aws:alb:LoadBalancer
    properties:
      tags: 
        Name: test-lb
      name: testing
      subnets: 
        - subnet-eacf3697
        - subnet-939b18f8
  TG:
    type: aws:alb:TargetGroup
    properties:
      port: 80
      protocol: 'HTTP'
      vpcId: ${VPC} 

  testTargetGroupAttachment:
    type: aws:alb:TargetGroupAttachment
    properties:
      targetGroupArn: ${TG.arn}
      targetId: someid
      port: 80
  httpListener:
    type: aws:alb:Listener
    properties:
      loadBalancerArn: ${alb.arn}
      port: 80
      protocol: "HTTP"
      defaultActions: 
        - type: "forward"
          targetGroupArn: ${TG.arn}

Although it may be related to

This not happens when I'm trying to run it driectly in my laptop, apperntly it happens only in the k8s operator.

Are you running an operator on your laptop, or a standalone program like I did.

targetId: ${ec2.id}

Probably irrelevant, but what is ec2? Are there some other bits in your program?

@mikhailshilkov mikhailshilkov added awaiting-feedback and removed needs-triage Needs attention from the triage team labels Nov 21, 2023
@devopsmash
Copy link
Author

Hi @mikhailshilkov ,

Probably irrelevant, but what is ec2? Are there some other bits in your program?

I have created ec2 as well, but I didn't add the relevant config here because I thought that it's irrelevant, here is a sample for that config:

    ec2:
      type: aws:ec2:Instance
      properties:
        ami: ami-089c26792dcb1fbd4
        iamInstanceProfile: ${ProfileName}
        instanceType: t3.micro
        keyName: test   

Are you running an operator on your laptop, or a standalone program like I did.

I'm running kind (local k8s) with the pulumi k8s operator as a pod, it seems that this happens only in the k8s operator.

@devopsmash
Copy link
Author

Hi @mikhailshilkov, please let me know if you need additional information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants