Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into huijbers/standardize-sps
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr committed Nov 9, 2022
2 parents 357d7b6 + 4bdb18e commit 622a2cd
Show file tree
Hide file tree
Showing 329 changed files with 9,642 additions and 4,449 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ Adding a new flag looks as follows:
your description, be sure to cover the following:
- Consciously pick the type of feature flag. Can the flag be removed in a future major version, or not?
- Motivate why the feature flag exists. What is the change to existing infrastructure and why is it not safe?
- In case of a "default change flag", describe what the user needs to do to restore the old behavior.
4. Add an entry for your feature flag in the [README](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cx-api/README.md) file.
5. In your tests, ensure that you test your feature with and without the feature flag enabled. You can do this by passing the feature flag to the `context` property when instantiating an `App`.
```ts
Expand Down
10 changes: 0 additions & 10 deletions buildspec-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ version: 0.2

# This buildspec is intended to be used by GitHub PR builds.

env:
variables:
# Update package.json with "exclude" statements for all failing rules.
# Whenever a new attribute to any resource in the CFN spec, by default
# awslint will block the build because the attribute does not exist in
# the corresponding L2 ('resource-attribute' rule). By ignoring it
# automatically, we save on-call time, and users who have lived without
# this attribute so far can wait for a bit longer.
AWSLINT_SAVE: "true"

phases:
install:
commands:
Expand Down
20 changes: 20 additions & 0 deletions packages/@aws-cdk/aws-apprunner/lib/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ export class Runtime {
*/
public static readonly CORRETTO_11 = Runtime.of('CORRETTO_11')

/**
* .NET 6
*/
public static readonly DOTNET_6 = Runtime.of('DOTNET_6')

/**
* Go 1.18
*/
public static readonly GO_1 = Runtime.of('GO_1')

/**
* NodeJS 12
*/
Expand All @@ -118,11 +128,21 @@ export class Runtime {
*/
public static readonly NODEJS_16 = Runtime.of('NODEJS_16')

/**
* PHP 8.1
*/
public static readonly PHP_81 = Runtime.of('PHP_81')

/**
* Python 3
*/
public static readonly PYTHON_3 = Runtime.of('PYTHON_3')

/**
* Ruby 3.1
*/
public static readonly RUBY_31 = Runtime.of('RUBY_31')

/**
* Other runtimes
*
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-cloudfront/lib/distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,9 @@ export class Distribution extends Resource implements IDistribution {
} else {
const originIndex = this.boundOrigins.length + 1;
const scope = new Construct(this, `Origin${originIndex}`);
const originId = Names.uniqueId(scope).slice(-ORIGIN_ID_MAX_LENGTH);
const originBindConfig = origin.bind(scope, { originId });
const generatedId = Names.uniqueId(scope).slice(-ORIGIN_ID_MAX_LENGTH);
const originBindConfig = origin.bind(scope, { originId: generatedId });
const originId = originBindConfig.originProperty?.id ?? generatedId;
const duplicateId = this.boundOrigins.find(boundOrigin => boundOrigin.originProperty?.id === originBindConfig.originProperty?.id);
if (duplicateId) {
throw new Error(`Origin with id ${duplicateId.originProperty?.id} already exists. OriginIds must be unique within a distribution`);
Expand Down
54 changes: 54 additions & 0 deletions packages/@aws-cdk/aws-cloudfront/test/distribution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,60 @@ describe('origin IDs', () => {
});
});

describe('custom origin ids', () => {
test('test that originId param is respected', () => {
const origin = defaultOrigin(undefined, 'custom-origin-id');

const distribution = new Distribution(stack, 'Http1Distribution', {
defaultBehavior: { origin },
additionalBehaviors: {
secondUsage: {
origin,
},
},
});
distribution.addBehavior(
'thirdUsage',
origin,
);

Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', {
DistributionConfig: {
DefaultCacheBehavior: {
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
Compress: true,
TargetOriginId: 'custom-origin-id',
ViewerProtocolPolicy: 'allow-all',
},
CacheBehaviors: [{
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
Compress: true,
PathPattern: 'secondUsage',
TargetOriginId: 'custom-origin-id',
ViewerProtocolPolicy: 'allow-all',
},
{
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
Compress: true,
PathPattern: 'thirdUsage',
TargetOriginId: 'custom-origin-id',
ViewerProtocolPolicy: 'allow-all',
}],
Enabled: true,
HttpVersion: 'http2',
IPV6Enabled: true,
Origins: [{
DomainName: 'www.example.com',
Id: 'custom-origin-id',
CustomOriginConfig: {
OriginProtocolPolicy: 'https-only',
},
}],
},
});
});
});

describe('supported HTTP versions', () => {
test('setting HTTP/1.1 renders HttpVersion correctly', () => {
new Distribution(stack, 'Http1Distribution', {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
"path": "DistributionOriginIdDefaultTestDeployAssert16FC3109.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"21.0.0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"413425a9c32869faf78d5031f15a0e8f5eed244599a8c576f6f4c025d23505e6": {
"source": {
"path": "integ-distribution-origin-id.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "413425a9c32869faf78d5031f15a0e8f5eed244599a8c576f6f4c025d23505e6.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"Resources": {
"TestDistribution94EC811C": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"CacheBehaviors": [
{
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"PathPattern": "/second",
"TargetOriginId": "my-custom-origin-id",
"ViewerProtocolPolicy": "allow-all"
},
{
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"PathPattern": "/third",
"TargetOriginId": "my-custom-origin-id",
"ViewerProtocolPolicy": "allow-all"
}
],
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "my-custom-origin-id",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "my-custom-origin-id"
}
]
}
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "21.0.0",
"testCases": {
"DistributionOriginId/DefaultTest": {
"stacks": [
"integ-distribution-origin-id"
],
"assertionStack": "DistributionOriginId/DefaultTest/DeployAssert",
"assertionStackName": "DistributionOriginIdDefaultTestDeployAssert16FC3109"
}
}
}
Loading

0 comments on commit 622a2cd

Please sign in to comment.