diff --git a/.github/workflows/lambda.yml b/.github/workflows/lambda.yml
index 626c2f4..9053d93 100644
--- a/.github/workflows/lambda.yml
+++ b/.github/workflows/lambda.yml
@@ -10,6 +10,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
+ - name: Get GitHub Commit SHA based on Ref
+ id: commit
+ run: |
+ if [[ '${{ github.ref }}' == 'refs/heads/master' ]]; then
+ echo "::set-output name=sha::${{ github.sha }}"
+ else
+ echo "::set-output name=sha::${{ github.event.pull_request.head.sha }}"
+ fi
# Checkout the pull request branch
- name: Checkout code
uses: actions/checkout@v2
@@ -30,10 +38,10 @@ jobs:
run: make build
- name: Deploy
- run: aws s3 cp --acl public-read artifacts/lambda.zip s3://artifacts.prod.cloudposse.org/${{ github.event.repository.name }}/${{ github.sha }}/lambda.zip
+ 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
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Test Download from CDN
- run: curl -fsSL -o /dev/null https://artifacts.cloudposse.com/${{ github.event.repository.name }}/${{ github.sha }}/lambda.zip
+ run: curl -fsSL -o /dev/null https://artifacts.cloudposse.com/${{ github.event.repository.name }}/${{ steps.commit.outputs.sha }}/lambda.zip
diff --git a/README.md b/README.md
index a7059db..567a34a 100644
--- a/README.md
+++ b/README.md
@@ -167,7 +167,7 @@ is given
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
-| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `null` | no |
+| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `""` | no |
| artifact\_url | URL template for the remote artifact | `string` | `"https://artifacts.cloudposse.com/$${module_name}/$${git_ref}/$${filename}"` | no |
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| context | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. |
object({|
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
})
{| no | diff --git a/docs/terraform.md b/docs/terraform.md index 784f48b..1614cf0 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -25,7 +25,7 @@ is given | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no | -| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `null` | no | +| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `""` | no | | artifact\_url | URL template for the remote artifact | `string` | `"https://artifacts.cloudposse.com/$${module_name}/$${git_ref}/$${filename}"` | no | | attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no | | context | Single object for setting entire context at once.
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
object({|
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
})
{| no | diff --git a/variables.tf b/variables.tf index 7a97b54..8b177ac 100644 --- a/variables.tf +++ b/variables.tf @@ -86,6 +86,6 @@ variable "artifact_url" { variable "artifact_git_ref" { type = string description = "Git ref of the lambda artifact to use. Use latest version if null." - default = null + default = "" }
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}