-
Notifications
You must be signed in to change notification settings - Fork 4k
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
apprunner-alpha: VpcIngressConnection uses incompatible IService instead of Service in JAVA #32745
Comments
Appears to be a valid use case. Just for comparison, in Unsure if we have any design guidelines for experimental constructs to follow certain pattern. In customer's use case, the possible workaround could be to use package com.myorg;
import software.constructs.Construct;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.apprunner.alpha.EcrPublicProps;
import software.amazon.awscdk.services.apprunner.alpha.ImageConfiguration;
import software.amazon.awscdk.services.apprunner.alpha.Service;
import software.amazon.awscdk.services.apprunner.alpha.Source;
import software.amazon.awscdk.services.apprunner.alpha.VpcIngressConnection;
import software.amazon.awscdk.services.ec2.Vpc;
import software.amazon.awscdk.services.ec2.InterfaceVpcEndpoint;
import software.amazon.awscdk.services.ec2.InterfaceVpcEndpointAwsService;
public class CdktestjavaStack extends Stack {
public CdktestjavaStack(final Construct scope, final String id) {
this(scope, id, null);
}
public CdktestjavaStack(final Construct scope, final String id, final StackProps props) {
super(scope, id, props);
Vpc vpc = Vpc.Builder.create(this, "testVpc").build();
InterfaceVpcEndpoint interfaceVpcEndpoint = InterfaceVpcEndpoint.Builder.create(this, "MyVpcEndpoint")
.vpc(vpc)
.service(InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS)
.privateDnsEnabled(false)
.build();
Service service = Service.Builder.create(this, "Service")
.serviceName("MyService")
.source(Source.fromEcrPublic(EcrPublicProps.builder()
.imageConfiguration(ImageConfiguration.builder()
.port(8000)
.build())
.imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
.build()))
.isPubliclyAccessible(false)
.build();
VpcIngressConnection.Builder.create(this, "VpcIngressConnection")
.vpc(vpc)
.interfaceVpcEndpoint(interfaceVpcEndpoint)
.service(Service.fromServiceName(this, "ServiceImported", service.getServiceName()))
.build();
}
} |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
The example provided in
VpcIngressConnection
does not work as the service method acceptssoftware.amazon.awscdk.services.apprunner.alpha.IService
. the service created in line 7 is of typesoftware.amazon.awscdk.services.apprunner.alpha.Service
which does not inherit fromIService
leading to a compilation error in the second last line when usingVpcIngressConnection#service(IService)
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
VpcIngressConnection#service(Service)
should not throw a compilation error when passing a service.Current Behavior
A compilation error in the second last line when using
VpcIngressConnection#service(IService)
with the service created byService.Builder#create()
Reproduction Steps
Just use the provided example in the documentation
Possible Solution
Either
Service
inheritIService
orVpcIngressConnection#service(IService)
toVpcIngressConnection#service(Service)
Additional Information/Context
No response
CDK CLI Version
2.174.0
Framework Version
No response
Node.js Version
v23.5.0
OS
Mac
Language
Java
Language Version
21
Other information
No response
The text was updated successfully, but these errors were encountered: