diff --git a/.github/workflows/auto-readme.yml b/.github/workflows/auto-readme.yml index 4be8860..ddb775b 100644 --- a/.github/workflows/auto-readme.yml +++ b/.github/workflows/auto-readme.yml @@ -1,10 +1,10 @@ name: Generate Readme on: - # Open a PR to update README on merge to master (as necessary) + # Open a PR to update README on merge to main (as necessary) push: branches: - - master + - main # Update README nightly schedule: @@ -14,28 +14,29 @@ jobs: update: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: readme/update shell: bash env: - GITHUB_TOKEN: "${{ secrets.GITHUB_BOT_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GH_BOT_TOKEN }}" run: | make init make readme/deps make readme - name: Create Pull Request - uses: cloudposse/actions/github/create-pull-request@master + uses: peter-evans/create-pull-request@v3 with: - labels: automated pr - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} - COMMIT_MESSAGE: "docs(README): auto update all sections" - PULL_REQUEST_TITLE: Automatic Update of README.md - PULL_REQUEST_BODY: |- + labels: | + automated pr + readme + token: ${{ secrets.GH_BOT_TOKEN }} + commit-message: "docs(README): auto update all sections" + title: Automatic Update of README.md + body: |- This is an auto-generated PR which updates the `README.md` from the `README.yaml` using the [`cloudposse/build-harness`](https://github.com/cloudposse/build-harness). - PULL_REQUEST_BRANCH: github-actions/auto-readme - BRANCH_SUFFIX: timestamp + branch: github-actions/auto-readme + branch-suffix: timestamp + base: main diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml new file mode 100644 index 0000000..1a8a36b --- /dev/null +++ b/.github/workflows/code-checks.yml @@ -0,0 +1,39 @@ +name: Code checks and tests + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.5 + + - name: Run Terraform format + id: fmt + run: terraform fmt -check + continue-on-error: true + + - name: Run Terraform init + id: init + run: terraform init -backend=false ./tests + + - name: Run Terraform validate + id: validate + run: terraform validate ./tests + + - name: Run Shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.GH_BOT_TOKEN }} + reporter: github-pr-review + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 53e4a49..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Terraform Lint - -on: - pull_request: - branches: - - master - push: - branches: - - master - -jobs: - terraform: - name: Terraform - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - - - name: Terraform Format - uses: hashicorp/terraform-github-actions@master - with: - tf_actions_version: 0.12.18 - tf_actions_subcommand: fmt - tf_actions_working_dir: '.' - tf_actions_comment: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} - - - name: Terraform Init - uses: hashicorp/terraform-github-actions@master - with: - tf_actions_version: 0.12.18 - tf_actions_subcommand: init - tf_actions_working_dir: './tests' - tf_actions_comment: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} - - - name: Terraform Validate - uses: hashicorp/terraform-github-actions@master - with: - tf_actions_version: 0.12.18 - tf_actions_subcommand: validate - tf_actions_working_dir: './tests' - tf_actions_comment: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6d956c..10c31ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,25 +1,28 @@ name: Release on: - push: + workflow_run: + workflows: + - "Code checks and tests" branches: - - master + - main + types: + - completed jobs: release: - name: release + name: Release runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@master + - uses: actions/checkout@v2 - - name: Semantic Release - uses: cycjimmy/semantic-release-action@master + - name: Run Semantic Release + uses: cycjimmy/semantic-release-action@v2 id: semantic with: - branch: master + branch: main extra_plugins: | @semantic-release/git @semantic-release/changelog env: - GITHUB_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml deleted file mode 100644 index cda26b7..0000000 --- a/.github/workflows/reviewdog.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Reviewdog - -on: [pull_request] - -jobs: - shellcheck: - name: runner / shellcheck - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - - - name: Shellcheck - uses: reviewdog/action-shellcheck@v1 - with: - github_token: ${{ secrets.GITHUB_BOT_TOKEN }} - reporter: github-pr-review diff --git a/.releaserc.yml b/.releaserc.yml index 2a4ad3b..b25172c 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -1,5 +1,5 @@ --- -branch: master +branch: main plugins: - "@semantic-release/commit-analyzer" diff --git a/CHANGELOG.md b/CHANGELOG.md index 67811a9..c395002 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# [2.0.0](https://github.com/enter-at/terraform-aws-lambda-layer/compare/v1.2.0...v2.0.0) (2020-11-27) + + +### Features + +* update terraform to version 0.13 ([728c283](https://github.com/enter-at/terraform-aws-lambda-layer/commit/728c2836792f22bfda2f3f6671d5958e0b7412d1)) + + +### BREAKING CHANGES + +* terraform has been updated to version 0.13 + # [1.2.0](https://github.com/enter-at/terraform-aws-lambda-layer/compare/v1.1.1...v1.2.0) (2019-12-17) diff --git a/README.md b/README.md index 8e1ce86..a953de2 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,11 @@ module "layer" { source_type = "python" rsync_pattern = [ - "--exclude=**tests**" - "--exclude="**__pycache__**" - "--include=*.py" + "--exclude='**tests**'", + "--exclude='**__pycache__**'", + "--include=module/{a,b,c}/", + "--include='*.py'", + "--exclude='module/*'" ] } ``` @@ -66,26 +68,43 @@ module "layer" { + + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.12.0 | + +## Providers + +| Name | Version | +|------|---------| +| archive | n/a | +| aws | n/a | +| null | n/a | +| random | n/a | + ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| compatible_runtimes | (Optional) A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified. | list(string) | `null` | no | -| description | (Optional) Description of what the Lambda layer does. | string | `null` | no | -| layer_name | (Required) A unique name for the Lambda Layer. | string | - | yes | -| package_file | (Optional) The location of the package manager config file. Can be one of (package.json, requirements.txt, Pipfile) | string | `null` | no | -| rsync_pattern | (Optional) A list of rsync pattern to include or exclude files and directories. | list(string) | `` | no | -| source_dir | (Optional) The location of the Lamvda layer source code. Requires source_type to be defined. | string | `null` | no | -| source_type | (Optional) The location of the Lambda layer source type. Can be one of (nodejs, python) | string | `null` | no | +|------|-------------|------|---------|:--------:| +| compatible\_runtimes | (Optional) A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified. | `list(string)` | `null` | no | +| description | (Optional) Description of what the Lambda layer does. | `string` | `null` | no | +| layer\_name | (Required) A unique name for the Lambda Layer. | `string` | n/a | yes | +| package\_file | (Optional) The location of the package manager config file. Can be one of (package.json, requirements.txt, Pipfile) | `string` | `null` | no | +| rsync\_pattern | (Optional) A list of rsync pattern to include or exclude files and directories. | `list(string)` |
[
"--include=*"
]
| no | +| source\_dir | (Optional) The location of the Lamvda layer source code. Requires source\_type to be defined. | `string` | `null` | no | +| source\_type | (Optional) The location of the Lambda layer source type. Can be one of (nodejs, python) | `string` | `null` | no | ## Outputs | Name | Description | |------|-------------| | arn | The Amazon Resource Name (ARN) of the Lambda layer with version. | -| created_date | The date the layer was created. | -| layer_arn | The Amazon Resource Name (ARN) of the Lambda layer without version. | -| source_code_size | The size in bytes of the layer .zip file. | +| created\_date | The date the layer was created. | +| layer\_arn | The Amazon Resource Name (ARN) of the Lambda layer without version. | +| source\_code\_size | The size in bytes of the layer .zip file. | | version | The Lamba layer version. | diff --git a/README.yaml b/README.yaml index 1e0b258..0aaaf19 100644 --- a/README.yaml +++ b/README.yaml @@ -68,10 +68,10 @@ usage: |- source_type = "python" rsync_pattern = [ - "--exclude='**tests**'" - "--exclude="'**__pycache__**'" - "--include=module/{a,b,c}/" - "--include='*.py'" + "--exclude='**tests**'", + "--exclude='**__pycache__**'", + "--include=module/{a,b,c}/", + "--include='*.py'", "--exclude='module/*'" ] } diff --git a/archive.tf b/archive.tf index c749d8b..1b55219 100644 --- a/archive.tf +++ b/archive.tf @@ -20,10 +20,11 @@ resource "null_resource" "build" { provisioner "local-exec" { command = "${path.module}/build.sh" environment = { - DIST_DIR = data.null_data_source.dist.outputs.path - SOURCE_DIR = var.source_dir - SOURCE_TYPE = var.source_type - PACKAGE_FILE = var.package_file + DIST_DIR = data.null_data_source.dist.outputs.path + SOURCE_DIR = var.source_dir + SOURCE_TYPE = var.source_type + PACKAGE_FILE = var.package_file + RSYNC_PATTERN = join(" ", var.rsync_pattern) } } } diff --git a/docs/terraform.md b/docs/terraform.md index 650e53e..1de0b78 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -1,22 +1,37 @@ +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.12.0 | + +## Providers + +| Name | Version | +|------|---------| +| archive | n/a | +| aws | n/a | +| null | n/a | +| random | n/a | + ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| compatible_runtimes | (Optional) A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified. | list(string) | `null` | no | -| description | (Optional) Description of what the Lambda layer does. | string | `null` | no | -| layer_name | (Required) A unique name for the Lambda Layer. | string | - | yes | -| package_file | (Optional) The location of the package manager config file. Can be one of (package.json, requirements.txt, Pipfile) | string | `null` | no | -| rsync_pattern | (Optional) A list of rsync pattern to include or exclude files and directories. | list(string) | `` | no | -| source_dir | (Optional) The location of the Lamvda layer source code. Requires source_type to be defined. | string | `null` | no | -| source_type | (Optional) The location of the Lambda layer source type. Can be one of (nodejs, python) | string | `null` | no | +|------|-------------|------|---------|:--------:| +| compatible\_runtimes | (Optional) A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified. | `list(string)` | `null` | no | +| description | (Optional) Description of what the Lambda layer does. | `string` | `null` | no | +| layer\_name | (Required) A unique name for the Lambda Layer. | `string` | n/a | yes | +| package\_file | (Optional) The location of the package manager config file. Can be one of (package.json, requirements.txt, Pipfile) | `string` | `null` | no | +| rsync\_pattern | (Optional) A list of rsync pattern to include or exclude files and directories. | `list(string)` |
[
"--include=*"
]
| no | +| source\_dir | (Optional) The location of the Lamvda layer source code. Requires source\_type to be defined. | `string` | `null` | no | +| source\_type | (Optional) The location of the Lambda layer source type. Can be one of (nodejs, python) | `string` | `null` | no | ## Outputs | Name | Description | |------|-------------| | arn | The Amazon Resource Name (ARN) of the Lambda layer with version. | -| created_date | The date the layer was created. | -| layer_arn | The Amazon Resource Name (ARN) of the Lambda layer without version. | -| source_code_size | The size in bytes of the layer .zip file. | +| created\_date | The date the layer was created. | +| layer\_arn | The Amazon Resource Name (ARN) of the Lambda layer without version. | +| source\_code\_size | The size in bytes of the layer .zip file. | | version | The Lamba layer version. | diff --git a/tests/main.tf b/tests/main.tf index a3ebec4..98f4825 100644 --- a/tests/main.tf +++ b/tests/main.tf @@ -1,9 +1,3 @@ -terraform { - required_version = ">= 0.12" - - backend "local" {} -} - provider "aws" { region = "eu-central-1" } diff --git a/tests/versions.tf b/tests/versions.tf new file mode 120000 index 0000000..8bd0ff1 --- /dev/null +++ b/tests/versions.tf @@ -0,0 +1 @@ +../versions.tf \ No newline at end of file diff --git a/versions.tf b/versions.tf index 7000b05..06c3d24 100644 --- a/versions.tf +++ b/versions.tf @@ -1,3 +1,17 @@ terraform { - required_version = "~> 0.12.0" + required_version = ">= 0.13" + required_providers { + archive = { + source = "hashicorp/archive" + } + aws = { + source = "hashicorp/aws" + } + null = { + source = "hashicorp/null" + } + random = { + source = "hashicorp/random" + } + } }