Description
When I create a Distribution with a defaultBehavior origin that points to a OriginGroup, the outcoming templates target ID points to the primaryOrigin of that OriginGroup instead of to the OriginGroup itself.
Reproduction Steps
const originGroup = new OriginGroup({
primaryOrigin: new S3Origin(someBucket, {originPath: "/"}),
fallbackOrigin: new HttpOrigin(`${api.restApiId}.execute-api.${this.region}.amazonaws.com`, {originPath: `/${api.deploymentStage.stageName}/thumbnail`}),
fallbackStatusCodes: [404]}
)
const cdn = new Distribution(this, 'cdn', {
defaultBehavior: {
origin: originGroup
},
})
This (and many other configurations) create a Distribution with the primary origins target ID registered as default target, rather than the origin group.
What did you expect to happen?
I expected that the originGroup would be targeted by default.
Environment
- **CLI Version : ** 1.57.0
- **Framework Version: ** 1.57.0
- Node.js Version: v14.7.0
- OS : macOS 10.15.5
- Language (Version): Typescript 3.7.2
Other
The issue was introduced as part of the original implementation of OriginGroups: #9360
I have a fix ready at master...LarsFronius:default-behaviour-origin-groups - let me know if this looks as expected and I'll create the PR.
/cc ing @skinny85 : Since you created the original implementation and have the most context, perhaps you are the best to give this a review. Thank you!
This is 🐛 Bug Report
Activity
skinny85 commentedon Aug 11, 2020
@iliapolo I can take this one, since I was the one who implemented OriginGroups originally.
iliapolo commentedon Aug 11, 2020
@skinny85 go for it 😃
fix(cloudfront): ensures origin groups are added with their own ID as…