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

Could not create ALB + ECS(Fargate) with aws-cdk #915

Closed
inoutch opened this issue Oct 12, 2018 · 2 comments
Closed

Could not create ALB + ECS(Fargate) with aws-cdk #915

inoutch opened this issue Oct 12, 2018 · 2 comments

Comments

@inoutch
Copy link

inoutch commented Oct 12, 2018

I couldn't create application load balancer (alb) with fargate by aws-cdk, because default target type value of alb target group is instance.

To use fargate, I needs setting network mode to awsvpc, and setting target type to ip in target group. However, the aws-cdk implementation sets instance type as default, and no way to replace it after instancing alb target group.

To be accurate, I can change the target group type by adding any targets, however fargate is not neccesary to add ip targets manually, and I don't want to do it.

instancing target group and default type is TargetType.Ip:

new elb.ApplicationTargetGroup(this, "TargetGroup", { vpc }); // default targetType = TargeType.Instance

aws-elasticloadbalancingv2/lib/shared/base-target-group.js:

addLoadBalancerTarget(props) {
    if (this.targetType !== undefined && this.targetType !== props.targetType) {
        throw new Error(`Already have a of type '${this.targetType}', adding '${props.targetType}'; make all targets the same type.`);
    }
    // [[[CAN CHANGE TARGET TYPE ONLY HERE!]]]
    this.targetType = props.targetType;
    if (props.targetJson) {
        this.targetsJson.push(props.targetJson);
    }
}

Is there a way to solve this problem? (I am sorry if there is any mistake.)

@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 12, 2018

Just got fixed here: #890

Also, we're working on ECS constructs right now. Stay tuned for more goodness on that front.

@inoutch
Copy link
Author

inoutch commented Oct 12, 2018

Thank you for your quick replying.
I am looking forward to update about them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants