Skip to content

Commit 54b7b5a

Browse files
committed
fix: remove hardcoded typescript parser from prettier config
The parser: 'typescript' setting prevented prettier from formatting markdown files, causing pre-commit hooks to fail. Removing it allows prettier to auto-detect the correct parser based on file extension. Also includes IAM permission fixes: - Remove unused cloudformation:CreateStack permission - Remove unused cloudformation:DescribeStackEvents permission - Keep only cloudformation:DescribeEvents which is actually used - Update API documentation to reflect DescribeEvents usage
1 parent 6f3d490 commit 54b7b5a

3 files changed

Lines changed: 92 additions & 86 deletions

File tree

CONTRIBUTING.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,18 @@ We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikiped
6161
## Development
6262

6363
### Prerequisites
64+
6465
- Node.js 20+
6566
- npm
6667

6768
### Setup
69+
6870
```bash
6971
npm install
7072
```
7173

7274
### Testing
75+
7376
```bash
7477
# Run all tests
7578
npm test
@@ -85,6 +88,7 @@ npm run lint:fix
8588
```
8689

8790
### Building
91+
8892
```bash
8993
# Build the action
9094
npm run build
@@ -98,34 +102,36 @@ npm run package
98102
This action makes the following AWS CloudFormation API calls:
99103

100104
**Core Operations:**
105+
101106
- `DescribeStacks` - Check stack existence and status
102107
- `CreateChangeSet` - Create change sets for stack operations
103108
- `DescribeChangeSet` - Monitor change set status and retrieve changes
104109
- `ExecuteChangeSet` - Execute change sets (when not in create-only mode)
105110
- `DeleteChangeSet` - Clean up failed change sets
106111

107-
**Error Reporting:**
108-
- `DescribeStackEvents` - Retrieve detailed error information for validation failures
112+
**Event Streaming and Error Reporting:**
113+
114+
- `DescribeEvents` - Monitor real-time CloudFormation events and retrieve detailed error information
109115

110116
**Required Permissions:**
117+
111118
```json
112119
{
113-
"Version": "2012-10-17",
114-
"Statement": [
115-
{
116-
"Effect": "Allow",
117-
"Action": [
118-
"cloudformation:CreateStack",
119-
"cloudformation:DescribeStacks",
120-
"cloudformation:CreateChangeSet",
121-
"cloudformation:DescribeChangeSet",
122-
"cloudformation:DeleteChangeSet",
123-
"cloudformation:ExecuteChangeSet",
124-
"cloudformation:DescribeStackEvents"
125-
],
126-
"Resource": "*"
127-
}
128-
]
120+
"Version": "2012-10-17",
121+
"Statement": [
122+
{
123+
"Effect": "Allow",
124+
"Action": [
125+
"cloudformation:DescribeStacks",
126+
"cloudformation:CreateChangeSet",
127+
"cloudformation:DescribeChangeSet",
128+
"cloudformation:DeleteChangeSet",
129+
"cloudformation:ExecuteChangeSet",
130+
"cloudformation:DescribeEvents"
131+
],
132+
"Resource": "*"
133+
}
134+
]
129135
}
130136
```
131137

@@ -134,8 +140,8 @@ This action makes the following AWS CloudFormation API calls:
134140
The action uses a change set-based deployment approach:
135141

136142
1. **Stack Detection**: Check if stack exists using `DescribeStacks`
137-
2. **Change Set Creation**: Create change set using `CreateChangeSet`
143+
2. **Change Set Creation**: Create change set using `CreateChangeSet`
138144
3. **Change Set Validation**: Monitor status with `DescribeChangeSet`
139145
4. **Execution**: Execute change set with `ExecuteChangeSet` (unless create-only mode)
140146
5. **Output Processing**: Retrieve final stack state and outputs
141-
6. **Error Handling**: Use `DescribeStackEvents` for detailed error reporting
147+
6. **Error Handling**: Use `DescribeEvents` for detailed error reporting and event streaming

README.md

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Deploys AWS CloudFormation Stacks.
1313
with:
1414
name: MyStack
1515
template: myStack.yaml
16-
parameter-overrides: "MyParam1=myValue,MyParam2=${{ secrets.MY_SECRET_VALUE }}"
16+
parameter-overrides: 'MyParam1=myValue,MyParam2=${{ secrets.MY_SECRET_VALUE }}'
1717
```
1818
1919
The action can be passed a CloudFormation Stack `name` and a `template` file. The `template` file can be a local file existing in the working directory, or a URL to template that exists in an [Amazon S3](https://aws.amazon.com/s3/) bucket. It will create the Stack if it does not exist, or create a [Change Set](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html) to update the Stack. An update fails by default when the Change Set is empty. Setting `fail-on-empty-changeset: false` will override this behavior and not throw an error.
@@ -39,7 +39,7 @@ This action supports three modes of operation for better change set management:
3939
id: create-changeset
4040
uses: aws-actions/aws-cloudformation-github-deploy@v1
4141
with:
42-
mode: "create-only"
42+
mode: 'create-only'
4343
name: MyStack
4444
template: myStack.yaml
4545
@@ -58,7 +58,7 @@ This action supports three modes of operation for better change set management:
5858
- name: Execute Change Set
5959
uses: aws-actions/aws-cloudformation-github-deploy@v1
6060
with:
61-
mode: "execute-only"
61+
mode: 'execute-only'
6262
name: MyStack
6363
execute-change-set-id: ${{ steps.create-changeset.outputs.change-set-id }}
6464
```
@@ -71,10 +71,10 @@ Create change sets that can revert resource drift:
7171
- name: Create Drift-Reverting Change Set
7272
uses: aws-actions/aws-cloudformation-github-deploy@v1
7373
with:
74-
mode: "create-only"
74+
mode: 'create-only'
7575
name: MyStack
7676
template: myStack.yaml
77-
deployment-mode: "REVERT_DRIFT"
77+
deployment-mode: 'REVERT_DRIFT'
7878
```
7979

8080
### PR Review Workflow
@@ -88,8 +88,8 @@ on:
8888
pull_request:
8989
types: [opened, synchronize, reopened]
9090
paths:
91-
- "**.yaml"
92-
- "**.yml"
91+
- '**.yaml'
92+
- '**.yml'
9393
9494
permissions:
9595
id-token: write
@@ -112,10 +112,10 @@ jobs:
112112
id: create-cs
113113
uses: aws-actions/aws-cloudformation-github-deploy@v1
114114
with:
115-
mode: "create-only"
115+
mode: 'create-only'
116116
name: pr-review-${{ github.event.pull_request.number }}
117117
template: template.yaml
118-
parameter-overrides: "Environment=preview"
118+
parameter-overrides: 'Environment=preview'
119119
continue-on-error: true
120120
121121
- name: Post change set review
@@ -234,23 +234,21 @@ This action requires the following minimum set of permissions:
234234

235235
```json
236236
{
237-
"Version": "2012-10-17",
238-
"Statement": [
239-
{
240-
"Effect": "Allow",
241-
"Action": [
242-
"cloudformation:CreateStack",
243-
"cloudformation:DescribeStacks",
244-
"cloudformation:CreateChangeSet",
245-
"cloudformation:DescribeChangeSet",
246-
"cloudformation:DeleteChangeSet",
247-
"cloudformation:ExecuteChangeSet",
248-
"cloudformation:DescribeStackEvents",
249-
"cloudformation:DescribeEvents"
250-
],
251-
"Resource": "*"
252-
}
253-
]
237+
"Version": "2012-10-17",
238+
"Statement": [
239+
{
240+
"Effect": "Allow",
241+
"Action": [
242+
"cloudformation:DescribeStacks",
243+
"cloudformation:CreateChangeSet",
244+
"cloudformation:DescribeChangeSet",
245+
"cloudformation:DeleteChangeSet",
246+
"cloudformation:ExecuteChangeSet",
247+
"cloudformation:DescribeEvents"
248+
],
249+
"Resource": "*"
250+
}
251+
]
254252
}
255253
```
256254

@@ -280,9 +278,13 @@ The action makes the following AWS CloudFormation API calls depending on the ope
280278

281279
**Error Reporting (when change set creation fails):**
282280

283-
- `DescribeStackEvents` - Retrieve detailed error information for validation failures
281+
- `DescribeEvents` - Retrieve detailed error information for validation failures
284282
- `DeleteChangeSet` - Clean up failed change sets (unless `no-delete-failed-changeset` is set)
285283

284+
**Event Streaming (during stack operations):**
285+
286+
- `DescribeEvents` - Monitor real-time CloudFormation events during deployment
287+
286288
> The policy above prevents the stack from being deleted - add `cloudformation:DeleteStack` if deletion is required for your use case
287289

288290
## Example
@@ -312,43 +314,42 @@ jobs:
312314
outputs:
313315
env-name: ${{ steps.env-name.outputs.environment }}
314316
steps:
315-
- name: Checkout
316-
uses: actions/checkout@v2
317-
318-
- name: Configure AWS credentials
319-
id: creds
320-
uses: aws-actions/configure-aws-credentials@v1
321-
with:
322-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
323-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
324-
aws-region: ${{ github.event.inputs.region}}
325-
326-
- name: Configure environment name
327-
id: env-name
328-
env:
329-
REPO: ${{ github.repository }}
330-
run: |
331-
ENVIRONMENT=`echo $REPO | tr "/" "-"`
332-
echo "Environment name: $ENVIRONMENT"
333-
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
334-
335-
- name: Deploy Amazon EKS Cluster
336-
id: eks-cluster
337-
uses: aws-actions/aws-cloudformation-github-deploy@master
338-
with:
339-
name: ${{ steps.env-name.outputs.environment }}-cluster
340-
template: https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-master.template.yaml
341-
fail-on-empty-changeset: false
342-
parameter-overrides: >-
343-
AvailabilityZones=${{ github.event.inputs.region }}a,
344-
AvailabilityZones=${{ github.event.inputs.region }}c,
345-
KeyPairName=${{ github.event.inputs.keypair }},
346-
NumberOfAZs=2,
347-
ProvisionBastionHost=Disabled,
348-
EKSPublicAccessEndpoint=Enabled,
349-
EKSPrivateAccessEndpoint=Enabled,
350-
RemoteAccessCIDR=0.0.0.0/0
317+
- name: Checkout
318+
uses: actions/checkout@v2
319+
320+
- name: Configure AWS credentials
321+
id: creds
322+
uses: aws-actions/configure-aws-credentials@v1
323+
with:
324+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
325+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
326+
aws-region: ${{ github.event.inputs.region}}
351327
328+
- name: Configure environment name
329+
id: env-name
330+
env:
331+
REPO: ${{ github.repository }}
332+
run: |
333+
ENVIRONMENT=`echo $REPO | tr "/" "-"`
334+
echo "Environment name: $ENVIRONMENT"
335+
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
336+
337+
- name: Deploy Amazon EKS Cluster
338+
id: eks-cluster
339+
uses: aws-actions/aws-cloudformation-github-deploy@master
340+
with:
341+
name: ${{ steps.env-name.outputs.environment }}-cluster
342+
template: https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-master.template.yaml
343+
fail-on-empty-changeset: false
344+
parameter-overrides: >-
345+
AvailabilityZones=${{ github.event.inputs.region }}a,
346+
AvailabilityZones=${{ github.event.inputs.region }}c,
347+
KeyPairName=${{ github.event.inputs.keypair }},
348+
NumberOfAZs=2,
349+
ProvisionBastionHost=Disabled,
350+
EKSPublicAccessEndpoint=Enabled,
351+
EKSPrivateAccessEndpoint=Enabled,
352+
RemoteAccessCIDR=0.0.0.0/0
352353
```
353354
354355
### Proxy Configuration
@@ -365,7 +366,7 @@ with:
365366
name: eks-primary
366367
template: https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-master.template.yaml
367368
fail-on-empty-changeset: false
368-
http-proxy: "http://companydomain.com:3128"
369+
http-proxy: 'http://companydomain.com:3128'
369370
```
370371
371372
Proxy configured in the environment variable:

prettier.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ module.exports = {
66
semi: false,
77
trailingComma: 'none',
88
bracketSpacing: true,
9-
arrowParens: 'avoid',
10-
parser: 'typescript'
9+
arrowParens: 'avoid'
1110
}

0 commit comments

Comments
 (0)