aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

AWS::Amplify::App - [BUG] - drift incorrectly reported for CustomHeaders property

Open
#2,511 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

### Name of the resource

AWS::Amplify::App

### Issue Description

CloudFormation reports the `CustomHeaders` property for `AWS::Amplify::App` has been modified, however, the value has not been modified outside of CloudFormation.

### Expected Behavior

CloudFormation should not report drift for the `CustomHeaders` property

### Observed Behavior

1. CloudFormation reports drift for the `CustomHeaders` property showing the template YAML value provided does not equal the JSON array CloudFormation detects
2. Attempting to use the JSON for the `CustomHeaders` property shown in drift detection results in a yaml parsing error `Invalid request provided: Invalid spec, yaml parsing error: Invalid spec, top level must be key value pairs`

#### YAML

```yaml
customHeaders:
- pattern: /assets/*.json
headers:
- key: Cache-Control
value: no-store, no-cache, must-revalidate
```

#### JSON

```json
[{\"pattern\":\"/assets/*.json\",\"headers\":[{\"key\":\"Cache-Control\",\"value\":\"no-store, no-cache, must-revalidate\"}]}]
```

### Test Cases

```yaml
AmplifyApp:
Type: AWS::Amplify::App
Properties:
Name: "my-app"
Platform: WEB
# https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#amplify-console-environment-variables
EnvironmentVariables:
# deployment instead of git deployment
- Name: AMPLIFY_DIFF_DEPLOY
Value: false
# directory containing UI source code in monorepos
- Name: AMPLIFY_MONOREPO_APP_ROOT
Value: "frontend"
# Custom response headers to adjust Amplify Hosting behavior
# See https://docs.aws.amazon.com/amplify/latest/userguide/custom-header-YAML-format.html
# Disable caching configuration files under assets path
CustomHeaders: |
customHeaders:
- pattern: /assets/*.json
headers:
- key: Cache-Control
value: no-store, no-cache, must-revalidate
```

### Other Details

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the AWS::Amplify::App CustomHeaders drift with the YAML test case and compare it with the JSON shown by CloudFormation. Read the linked Amplify custom-header YAML-format documentation and determine whether the service or CloudFormation resource schema is producing the mismatch; done means the supplied template is accepted without a false drift report.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.