Skip to content

Commit ea43d1a

Browse files
authored
Workaround TF null default bug (#26)
1 parent e1075a6 commit ea43d1a

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

.github/workflows/lambda.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13+
- name: Get GitHub Commit SHA based on Ref
14+
id: commit
15+
run: |
16+
if [[ '${{ github.ref }}' == 'refs/heads/master' ]]; then
17+
echo "::set-output name=sha::${{ github.sha }}"
18+
else
19+
echo "::set-output name=sha::${{ github.event.pull_request.head.sha }}"
20+
fi
1321
# Checkout the pull request branch
1422
- name: Checkout code
1523
uses: actions/checkout@v2
@@ -30,10 +38,10 @@ jobs:
3038
run: make build
3139

3240
- name: Deploy
33-
run: aws s3 cp --acl public-read artifacts/lambda.zip s3://artifacts.prod.cloudposse.org/${{ github.event.repository.name }}/${{ github.sha }}/lambda.zip
41+
run: aws s3 cp --acl public-read artifacts/lambda.zip s3://artifacts.prod.cloudposse.org/${{ github.event.repository.name }}/${{ steps.commit.outputs.sha }}/lambda.zip
3442
env:
3543
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
3644
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3745

3846
- name: Test Download from CDN
39-
run: curl -fsSL -o /dev/null https://artifacts.cloudposse.com/${{ github.event.repository.name }}/${{ github.sha }}/lambda.zip
47+
run: curl -fsSL -o /dev/null https://artifacts.cloudposse.com/${{ github.event.repository.name }}/${{ steps.commit.outputs.sha }}/lambda.zip

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ is given
167167
| Name | Description | Type | Default | Required |
168168
|------|-------------|------|---------|:--------:|
169169
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
170-
| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `null` | no |
170+
| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `""` | no |
171171
| artifact\_url | URL template for the remote artifact | `string` | `"https://artifacts.cloudposse.com/$${module_name}/$${git_ref}/$${filename}"` | no |
172172
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
173173
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |

docs/terraform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ is given
2525
| Name | Description | Type | Default | Required |
2626
|------|-------------|------|---------|:--------:|
2727
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
28-
| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `null` | no |
28+
| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `""` | no |
2929
| artifact\_url | URL template for the remote artifact | `string` | `"https://artifacts.cloudposse.com/$${module_name}/$${git_ref}/$${filename}"` | no |
3030
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
3131
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ variable "artifact_url" {
8686
variable "artifact_git_ref" {
8787
type = string
8888
description = "Git ref of the lambda artifact to use. Use latest version if null."
89-
default = null
89+
default = ""
9090
}
9191

0 commit comments

Comments
 (0)