Skip to content

apprunner-alpha: VpcIngressConnection uses incompatible IService instead of Service in JAVA #32745

@muhamadto

Description

@muhamadto

Describe the bug

The example provided in VpcIngressConnection does not work as the service method accepts software.amazon.awscdk.services.apprunner.alpha.IService. the service created in line 7 is of type software.amazon.awscdk.services.apprunner.alpha.Service which does not inherit from IService leading to a compilation error in the second last line when using VpcIngressConnection#service(IService)

InterfaceVpcEndpoint interfaceVpcEndpoint = InterfaceVpcEndpoint.Builder.create(this, "MyVpcEndpoint")
        .vpc(vpc)
        .service(InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS)
        .privateDnsEnabled(false)
        .build();

Service service = Service.Builder.create(this, "Service")
        .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).   // incompatible types
        .build();

Regression Issue

  • Select this option if this issue appears to be a regression.

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 by Service.Builder#create()

Reproduction Steps

Just use the provided example in the documentation

Possible Solution

Either

  • MakeService inherit IService or
  • Change VpcIngressConnection#service(IService) to VpcIngressConnection#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-apprunnerRelated to the apprunner packagebugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions