Skip to content

Commit

Permalink
Merge branch 'master' into bump-cfnspec/v63.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 1, 2022
2 parents 3ee6dbe + 51419b6 commit 7a1def7
Show file tree
Hide file tree
Showing 37 changed files with 557 additions and 468 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"Resources": {
"Service1EDCC8134": {
"Type": "AWS::AppRunner::Service",
"Properties": {
"SourceConfiguration": {
"AuthenticationConfiguration": {},
"ImageRepository": {
"ImageConfiguration": {
"Port": "8000"
},
"ImageIdentifier": "public.ecr.aws/aws-containers/hello-app-runner:latest",
"ImageRepositoryType": "ECR_PUBLIC"
}
},
"InstanceConfiguration": {}
}
}
},
"Outputs": {
"URL1": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Fn::GetAtt": [
"Service1EDCC8134",
"ServiceUrl"
]
}
]
]
}
}
}
}
18 changes: 18 additions & 0 deletions packages/@aws-cdk/aws-apprunner/test/integ.service-ecr-public.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as cdk from '@aws-cdk/core';
import { Service, Source } from '../lib';


const app = new cdk.App();

const stack = new cdk.Stack(app, 'integ-apprunner-ecr-public');

// Scenario 1: Create the service from ECR public
const service1 = new Service(stack, 'Service1', {
source: Source.fromEcrPublic({
imageConfiguration: {
port: 8000,
},
imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest',
}),
});
new cdk.CfnOutput(stack, 'URL1', { value: `https://${service1.serviceUrl}` });
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
{
"Resources": {
"Service1EDCC8134": {
"Type": "AWS::AppRunner::Service",
"Properties": {
"SourceConfiguration": {
"AuthenticationConfiguration": {},
"ImageRepository": {
"ImageConfiguration": {
"Port": "8000"
},
"ImageIdentifier": "public.ecr.aws/aws-containers/hello-app-runner:latest",
"ImageRepositoryType": "ECR_PUBLIC"
}
},
"InstanceConfiguration": {}
}
},
"Service2AccessRole759CA73D": {
"Service3AccessRole3ACBAAA0": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
Expand All @@ -33,7 +17,7 @@
}
}
},
"Service2AccessRoleDefaultPolicy08C28479": {
"Service3AccessRoleDefaultPolicy57B9744E": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
Expand Down Expand Up @@ -66,37 +50,37 @@
{
"Ref": "AWS::AccountId"
},
":repository/nginx"
":repository/aws-cdk/assets"
]
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "Service2AccessRoleDefaultPolicy08C28479",
"PolicyName": "Service3AccessRoleDefaultPolicy57B9744E",
"Roles": [
{
"Ref": "Service2AccessRole759CA73D"
"Ref": "Service3AccessRole3ACBAAA0"
}
]
}
},
"Service2AB4D14D8": {
"Service342D067F2": {
"Type": "AWS::AppRunner::Service",
"Properties": {
"SourceConfiguration": {
"AuthenticationConfiguration": {
"AccessRoleArn": {
"Fn::GetAtt": [
"Service2AccessRole759CA73D",
"Service3AccessRole3ACBAAA0",
"Arn"
]
}
},
"ImageRepository": {
"ImageConfiguration": {
"Port": "80"
"Port": "8000"
},
"ImageIdentifier": {
"Fn::Join": [
Expand All @@ -113,7 +97,7 @@
{
"Ref": "AWS::URLSuffix"
},
"/nginx:latest"
"/aws-cdk/assets:77284835684772d19c95f4f5a37e7618d5f9efc40db9321d44ac039db457b967"
]
]
},
Expand All @@ -123,7 +107,7 @@
"InstanceConfiguration": {}
}
},
"Service3AccessRole3ACBAAA0": {
"Service2AccessRole759CA73D": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
Expand All @@ -140,7 +124,7 @@
}
}
},
"Service3AccessRoleDefaultPolicy57B9744E": {
"Service2AccessRoleDefaultPolicy08C28479": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
Expand Down Expand Up @@ -181,29 +165,29 @@
],
"Version": "2012-10-17"
},
"PolicyName": "Service3AccessRoleDefaultPolicy57B9744E",
"PolicyName": "Service2AccessRoleDefaultPolicy08C28479",
"Roles": [
{
"Ref": "Service3AccessRole3ACBAAA0"
"Ref": "Service2AccessRole759CA73D"
}
]
}
},
"Service342D067F2": {
"Service2AB4D14D8": {
"Type": "AWS::AppRunner::Service",
"Properties": {
"SourceConfiguration": {
"AuthenticationConfiguration": {
"AccessRoleArn": {
"Fn::GetAtt": [
"Service3AccessRole3ACBAAA0",
"Service2AccessRole759CA73D",
"Arn"
]
}
},
"ImageRepository": {
"ImageConfiguration": {
"Port": "8000"
"Port": "80"
},
"ImageIdentifier": {
"Fn::Join": [
Expand All @@ -229,89 +213,9 @@
},
"InstanceConfiguration": {}
}
},
"Service429949929": {
"Type": "AWS::AppRunner::Service",
"Properties": {
"SourceConfiguration": {
"AuthenticationConfiguration": {
"ConnectionArn": "MOCK"
},
"CodeRepository": {
"CodeConfiguration": {
"ConfigurationSource": "REPOSITORY"
},
"RepositoryUrl": "https://github.com/aws-containers/hello-app-runner",
"SourceCodeVersion": {
"Type": "BRANCH",
"Value": "main"
}
}
},
"InstanceConfiguration": {}
}
},
"Service5AD92B5A5": {
"Type": "AWS::AppRunner::Service",
"Properties": {
"SourceConfiguration": {
"AuthenticationConfiguration": {
"ConnectionArn": "MOCK"
},
"CodeRepository": {
"CodeConfiguration": {
"CodeConfigurationValues": {
"BuildCommand": "yum install -y pycairo && pip install -r requirements.txt",
"Port": "8000",
"Runtime": "PYTHON_3",
"StartCommand": "python app.py"
},
"ConfigurationSource": "API"
},
"RepositoryUrl": "https://github.com/aws-containers/hello-app-runner",
"SourceCodeVersion": {
"Type": "BRANCH",
"Value": "main"
}
}
},
"InstanceConfiguration": {}
}
}
},
"Outputs": {
"URL1": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Fn::GetAtt": [
"Service1EDCC8134",
"ServiceUrl"
]
}
]
]
}
},
"URL2": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Fn::GetAtt": [
"Service2AB4D14D8",
"ServiceUrl"
]
}
]
]
}
},
"URL3": {
"Value": {
"Fn::Join": [
Expand All @@ -328,31 +232,15 @@
]
}
},
"URL4": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Fn::GetAtt": [
"Service429949929",
"ServiceUrl"
]
}
]
]
}
},
"URL5": {
"URL2": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Fn::GetAtt": [
"Service5AD92B5A5",
"Service2AB4D14D8",
"ServiceUrl"
]
}
Expand Down
32 changes: 32 additions & 0 deletions packages/@aws-cdk/aws-apprunner/test/integ.service-ecr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as path from 'path';
import * as assets from '@aws-cdk/aws-ecr-assets';
import * as cdk from '@aws-cdk/core';
import { Service, Source } from '../lib';


const app = new cdk.App();

const stack = new cdk.Stack(app, 'integ-apprunner');


// Scenario 3: Create the service from local code assets
const imageAsset = new assets.DockerImageAsset(stack, 'ImageAssets', {
directory: path.join(__dirname, './docker.assets'),
});
const service3 = new Service(stack, 'Service3', {
source: Source.fromAsset({
imageConfiguration: { port: 8000 },
asset: imageAsset,
}),
});
new cdk.CfnOutput(stack, 'URL3', { value: `https://${service3.serviceUrl}` });

// Scenario 2: Create the service from existing ECR repository
const service2 = new Service(stack, 'Service2', {
source: Source.fromEcr({
imageConfiguration: { port: 80 },
repository: imageAsset.repository,
tag: imageAsset.assetHash,
}),
});
new cdk.CfnOutput(stack, 'URL2', { value: `https://${service2.serviceUrl}` });
Loading

0 comments on commit 7a1def7

Please sign in to comment.