Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix YAML native parameters and tags #152

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module.exports = {
// Prettier
'**/*.{md}': ['prettier --ignore-path .gitignore --write'],

// Eslint
'**/*.{ts,tsx}': ['eslint --fix'],

// Jest
'**/*.test.{ml,mli,mly,ts,js,json}': 'jest',
}

// Prettier
'**/*.{md}': ['prettier --ignore-path .gitignore --write'],

// Eslint
'**/*.{ts,tsx}': ['eslint --fix'],

// Jest
'**/*.test.{ml,mli,mly,ts,js,json}': 'jest'
}
102 changes: 90 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## AWS CloudFormation "Deploy CloudFormation Stack" Action for GitHub Actions
<!-- trunk-ignore-all(prettier/SyntaxError) -->
# AWS CloudFormation "Deploy CloudFormation Stack" Action for GitHub Actions

![Package](https://github.com/aws-actions/aws-cloudformation-github-deploy/workflows/Package/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Expand All @@ -24,13 +25,27 @@ A few inputs are highlighted below. See [action.yml](action.yml) for the full do

#### parameter-overrides (OPTIONAL)

To override parameter values in the template you can provide a string or a file that is either local or an URL.
To override parameter values in the template you can provide a string, a file that is either local or an URL, or a native YAML object.

Override multiple parameters separated by commas: `"MyParam1=myValue1,MyParam2=myValue2"`

Override a comma delimited list: `"MyParam1=myValue1,MyParam1=myValue2"` or `MyParam1="myValue1,myValue2"`

Override parameters using a almost native YAML object :

```yaml
parameter-overrides: |
MyParam1: myValue1
MyParam2: myValue2
MyListParam:
- item1
- item2
```

**!Note** GitHub Actions requre all parameters to be a string, but we can pass a YAML object via string.

Override parameters using a local JSON file: `"file:///${{ github.workspace }}/parameters.json"` with a file named `parameters.json` at the root of the repository:

```json
[
{
Expand All @@ -42,6 +57,64 @@ Override parameters using a local JSON file: `"file:///${{ github.workspace }}/p

> You can learn more about [AWS CloudFormation](https://aws.amazon.com/cloudformation/)

## Setting Tags

You can add tags to your CloudFormation stack by using the `tags` parameter. Tags can be specified in three formats:

Using YAML array format:

```yaml
- uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: MyStack
template: myStack.yaml
tags: |
- Key: Environment
Value: Production
- Key: Team
Value: DevOps
```

**!Note** GitHub Actions requre all parameters to be a string, but we can pass a YAML object via string.

Using YAML object format:

```yaml
- uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: MyStack
template: myStack.yaml
tags: |
Environment: Production
Team: DevOps
```

**!Note** GitHub Actions requre all parameters to be a string, but we can pass a YAML object via string.

Using JSON formating:

```yaml
- uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: MyStack
template: myStack.yaml
tags: |
[
{
"Key": "Environment",
"Value": "Production"
},
{
"Key": "Team",
"Value": "DevOps"
}
]
```

**!Note** GitHub Actions requre all parameters to be a string, but we can pass a JSON object via string.

Tags specified during stack creation or update will be applied to the stack and all its resources that support tagging. These tags can be useful for cost allocation, access control, and resource organization.

## Credentials and Region

This action relies on the [default behavior of the AWS SDK for Javascript](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html) to determine AWS credentials and region.
Expand All @@ -61,7 +134,7 @@ This action requires the following minimum set of permissions:

> We recommend to read [AWS CloudFormation Security Best Practices](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html)

```
```json
{
"Version": "2012-10-17",
"Statement": [
Expand Down Expand Up @@ -137,15 +210,19 @@ jobs:
name: ${{ steps.env-name.outputs.environment }}-cluster
template: https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-master.template.yaml
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
AvailabilityZones=${{ github.event.inputs.region }}a,
AvailabilityZones=${{ github.event.inputs.region }}c,
KeyPairName=${{ github.event.inputs.keypair }},
NumberOfAZs=2,
ProvisionBastionHost=Disabled,
EKSPublicAccessEndpoint=Enabled,
EKSPrivateAccessEndpoint=Enabled,
RemoteAccessCIDR=0.0.0.0/0
parameter-overrides: |
AvailabilityZones:
- ${{ github.event.inputs.region }}a
- ${{ github.event.inputs.region }}c
KeyPairName: ${{ github.event.inputs.keypair }}
NumberOfAZs: 2
ProvisionBastionHost: Disabled
EKSPublicAccessEndpoint: Enabled
EKSPrivateAccessEndpoint: Enabled
RemoteAccessCIDR: 0.0.0.0/0
tags: |
Environmnet: Develop
Owner: DevOps

```

Expand All @@ -156,6 +233,7 @@ If you run in self-hosted environments and in secured environment where you need
Additionally this action will always consider already configured proxy in the environment.

Manually configured proxy:

```yaml
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
Expand Down
Loading