diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..6f64b5a
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,25 @@
+# Use this file to define individuals or teams that are responsible for code in a repository.
+# Read more:
+#
+# Order is important: the last matching pattern has the highest precedence
+
+# These owners will be the default owners for everything
+* @cloudposse/engineering @cloudposse/contributors
+
+# Cloud Posse must review any changes to Makefiles
+**/Makefile @cloudposse/engineering
+**/Makefile.* @cloudposse/engineering
+
+# Cloud Posse must review any changes to GitHub actions
+.github/* @cloudposse/engineering
+
+# Cloud Posse must review any changes to standard context definition,
+# but some changes can be rubber-stamped.
+**/*.tf @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
+README.yaml @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
+README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
+docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
+
+# Cloud Posse Admins must review all changes to CODEOWNERS or the mergify configuration
+.github/mergify.yml @cloudposse/admins
+.github/CODEOWNERS @cloudposse/admins
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000..94d3246
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,72 @@
+---
+name: Bug report
+description: Create a report to help us improve
+labels: ["bug"]
+assignees: [""]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Found a bug?
+
+ Please checkout our [Slack Community](https://slack.cloudposse.com)
+ or visit our [Slack Archive](https://archive.sweetops.com/).
+
+ [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
+
+ - type: textarea
+ id: concise-description
+ attributes:
+ label: Describe the Bug
+ description: A clear and concise description of what the bug is.
+ placeholder: What is the bug about?
+ validations:
+ required: true
+
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected Behavior
+ description: A clear and concise description of what you expected.
+ placeholder: What happened?
+ validations:
+ required: true
+
+ - type: textarea
+ id: reproduction-steps
+ attributes:
+ label: Steps to Reproduce
+ description: Steps to reproduce the behavior.
+ placeholder: How do we reproduce it?
+ validations:
+ required: true
+
+ - type: textarea
+ id: screenshots
+ attributes:
+ label: Screenshots
+ description: If applicable, add screenshots or logs to help explain.
+ validations:
+ required: false
+
+ - type: textarea
+ id: environment
+ attributes:
+ label: Environment
+ description: Anything that will help us triage the bug.
+ placeholder: |
+ - OS: [e.g. Linux, OSX, WSL, etc]
+ - Version [e.g. 10.15]
+ - Module version
+ - Terraform version
+ validations:
+ required: false
+
+ - type: textarea
+ id: additional
+ attributes:
+ label: Additional Context
+ description: |
+ Add any other context about the problem here.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..76ae6d6
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,18 @@
+blank_issues_enabled: false
+
+contact_links:
+
+ - name: Community Slack Team
+ url: https://cloudposse.com/slack/
+ about: |-
+ Please ask and answer questions here.
+
+ - name: Office Hours
+ url: https://cloudposse.com/office-hours/
+ about: |-
+ Join us every Wednesday for FREE Office Hours (lunch & learn).
+
+ - name: DevOps Accelerator Program
+ url: https://cloudposse.com/accelerate/
+ about: |-
+ Own your infrastructure in record time. We build it. You drive it.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000..7b86672
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,71 @@
+---
+name: Feature Request
+description: Suggest an idea for this project
+labels: ["feature request"]
+assignees: [""]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Have a question?
+
+ Please checkout our [Slack Community](https://slack.cloudposse.com)
+ or visit our [Slack Archive](https://archive.sweetops.com/).
+
+ [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
+
+ - type: textarea
+ id: concise-description
+ attributes:
+ label: Describe the Feature
+ description: A clear and concise description of what the feature is.
+ placeholder: What is the feature about?
+ validations:
+ required: true
+
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected Behavior
+ description: A clear and concise description of what you expected.
+ placeholder: What happened?
+ validations:
+ required: true
+
+ - type: textarea
+ id: use-case
+ attributes:
+ label: Use Case
+ description: |
+ Is your feature request related to a problem/challenge you are trying
+ to solve?
+
+ Please provide some additional context of why this feature or
+ capability will be valuable.
+ validations:
+ required: true
+
+ - type: textarea
+ id: ideal-solution
+ attributes:
+ label: Describe Ideal Solution
+ description: A clear and concise description of what you want to happen.
+ validations:
+ required: true
+
+ - type: textarea
+ id: alternatives-considered
+ attributes:
+ label: Alternatives Considered
+ description: Explain alternative solutions or features considered.
+ validations:
+ required: false
+
+ - type: textarea
+ id: additional
+ attributes:
+ label: Additional Context
+ description: |
+ Add any other context about the problem here.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md
new file mode 100644
index 0000000..e69de29
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..8944933
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,21 @@
+## what
+
+
+
+## why
+
+
+
+## references
+
+
diff --git a/.github/auto-release.yml b/.github/auto-release.yml
new file mode 100644
index 0000000..cc9bf05
--- /dev/null
+++ b/.github/auto-release.yml
@@ -0,0 +1,54 @@
+name-template: 'v$RESOLVED_VERSION'
+tag-template: '$RESOLVED_VERSION'
+version-template: '$MAJOR.$MINOR.$PATCH'
+version-resolver:
+ major:
+ labels:
+ - 'major'
+ minor:
+ labels:
+ - 'minor'
+ - 'enhancement'
+ patch:
+ labels:
+ - 'auto-update'
+ - 'patch'
+ - 'fix'
+ - 'bugfix'
+ - 'bug'
+ - 'hotfix'
+ default: 'minor'
+filter-by-commitish: true
+
+categories:
+- title: '🚀 Enhancements'
+ labels:
+ - 'enhancement'
+ - 'patch'
+- title: '🐛 Bug Fixes'
+ labels:
+ - 'fix'
+ - 'bugfix'
+ - 'bug'
+ - 'hotfix'
+- title: '🤖 Automatic Updates'
+ labels:
+ - 'auto-update'
+
+change-template: |
+
+ $TITLE @$AUTHOR (#$NUMBER)
+
+ $BODY
+
+
+template: |
+ $CHANGES
+
+replacers:
+# Remove irrelevant information from Renovate bot
+- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
+ replace: ''
+# Remove Renovate bot banner image
+- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
+ replace: ''
diff --git a/.github/mergify.yml b/.github/mergify.yml
new file mode 100644
index 0000000..148d85c
--- /dev/null
+++ b/.github/mergify.yml
@@ -0,0 +1,76 @@
+# https://docs.mergify.io/conditions.html
+# https://docs.mergify.io/actions.html
+pull_request_rules:
+- name: "approve automated PRs that have passed checks"
+ conditions:
+ - "author~=^(cloudpossebot|renovate\\[bot\\])$"
+ - "-closed"
+ - "head~=^(auto-update|renovate)/.*"
+ - "check-success=test/bats"
+ - "check-success=test/readme"
+ - "check-success=test/terratest"
+ - "check-success=validate-codeowners"
+ - or:
+ - "base=master"
+ - "base=main"
+ - "base~=^release/v\\d{1,2}$"
+
+ actions:
+ review:
+ type: "APPROVE"
+ bot_account: "cloudposse-mergebot"
+ message: "We've automatically approved this PR because the checks from the automated Pull Request have passed."
+
+- name: "merge automated PRs when approved and tests pass"
+ conditions:
+ - "author~=^(cloudpossebot|renovate\\[bot\\])$"
+ - "-closed"
+ - "head~=^(auto-update|renovate)/.*"
+ - "check-success=test/bats"
+ - "check-success=test/readme"
+ - "check-success=test/terratest"
+ - "check-success=validate-codeowners"
+ - "#approved-reviews-by>=1"
+ - "#changes-requested-reviews-by=0"
+ - "#commented-reviews-by=0"
+ - or:
+ - "base=master"
+ - "base=main"
+ - "base~=^release/v\\d{1,2}$"
+
+ actions:
+ merge:
+ method: "squash"
+
+- name: "delete the head branch after merge"
+ conditions:
+ - "merged"
+ actions:
+ delete_head_branch: {}
+
+- name: "ask to resolve conflict"
+ conditions:
+ - "conflict"
+ - "-closed"
+ actions:
+ comment:
+ message: "This pull request is now in conflict. Could you fix it @{{author}}? 🙏"
+
+- name: "remove outdated reviews"
+ conditions:
+ - or:
+ - "base=master"
+ - "base=main"
+ - "base~=^release/v\\d{1,2}$"
+ actions:
+ dismiss_reviews:
+ changes_requested: true
+ approved: true
+ message: "This Pull Request has been updated, so we're dismissing all reviews."
+
+- name: "close Pull Requests without files changed"
+ conditions:
+ - "#files=0"
+ actions:
+ close:
+ message: "This pull request has been automatically closed by Mergify because there are no longer any changes."
diff --git a/.github/renovate.json b/.github/renovate.json
new file mode 100644
index 0000000..b61ed24
--- /dev/null
+++ b/.github/renovate.json
@@ -0,0 +1,13 @@
+{
+ "extends": [
+ "config:base",
+ ":preserveSemverRanges"
+ ],
+ "baseBranches": ["main", "master", "/^release\\/v\\d{1,2}$/"],
+ "labels": ["auto-update"],
+ "dependencyDashboardAutoclose": true,
+ "enabledManagers": ["terraform"],
+ "terraform": {
+ "ignorePaths": ["**/context.tf", "examples/**"]
+ }
+}
diff --git a/.github/workflows/feature-branch-chatops.yml b/.github/workflows/feature-branch-chatops.yml
new file mode 100644
index 0000000..9abfc61
--- /dev/null
+++ b/.github/workflows/feature-branch-chatops.yml
@@ -0,0 +1,16 @@
+---
+name: feature-branch-chatops
+on:
+ issue_comment:
+ types: [created]
+
+permissions:
+ pull-requests: write
+ id-token: write
+ contents: write
+
+jobs:
+ terraform-module:
+ uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/feature-branch-chatops.yml@main
+ secrets:
+ github_access_token: ${{ secrets.REPO_ACCESS_TOKEN }}
diff --git a/.github/workflows/feature-branch.yml b/.github/workflows/feature-branch.yml
new file mode 100644
index 0000000..8faa955
--- /dev/null
+++ b/.github/workflows/feature-branch.yml
@@ -0,0 +1,19 @@
+---
+name: feature-branch
+on:
+ pull_request:
+ branches:
+ - main
+ - release/**
+ types: [opened, synchronize, reopened, labeled, unlabeled]
+
+permissions:
+ pull-requests: write
+ id-token: write
+ contents: write
+
+jobs:
+ terraform-module:
+ uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/feature-branch.yml@main
+ secrets:
+ github_access_token: ${{ secrets.REPO_ACCESS_TOKEN }}
diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml
new file mode 100644
index 0000000..3f8fe62
--- /dev/null
+++ b/.github/workflows/release-branch.yml
@@ -0,0 +1,22 @@
+---
+name: release-branch
+on:
+ push:
+ branches:
+ - main
+ - release/**
+ paths-ignore:
+ - '.github/**'
+ - 'docs/**'
+ - 'examples/**'
+ - 'test/**'
+
+permissions:
+ contents: write
+ id-token: write
+
+jobs:
+ terraform-module:
+ uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-branch.yml@main
+ secrets:
+ github_access_token: ${{ secrets.REPO_ACCESS_TOKEN }}
diff --git a/.github/workflows/release-published.yml b/.github/workflows/release-published.yml
new file mode 100644
index 0000000..f86352b
--- /dev/null
+++ b/.github/workflows/release-published.yml
@@ -0,0 +1,14 @@
+---
+name: release-published
+on:
+ release:
+ types:
+ - published
+
+permissions:
+ contents: write
+ id-token: write
+
+jobs:
+ terraform-module:
+ uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml
new file mode 100644
index 0000000..163be0b
--- /dev/null
+++ b/.github/workflows/scheduled.yml
@@ -0,0 +1,17 @@
+---
+name: scheduled
+on:
+ workflow_dispatch: { } # Allows manually trigger this workflow
+ schedule:
+ - cron: "0 3 * * *"
+
+permissions:
+ pull-requests: write
+ id-token: write
+ contents: write
+
+jobs:
+ scheduled:
+ uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/scheduled.yml@main
+ secrets:
+ github_access_token: ${{ secrets.REPO_ACCESS_TOKEN }}
diff --git a/README.md b/README.md
index 5cd93f5..bc2a940 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,42 @@
-
+
+
+# terraform-aws-ec2-ami-backup [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ec2-ami-backup.svg)](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup/releases) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
+
+
[![README Header][readme_header_img]][readme_header_link]
[![Cloud Posse][logo]](https://cpco.io/homepage)
-# terraform-aws-ec2-ami-backup [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ec2-ami-backup.svg)](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup/releases) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
+
+
This repo contains a terraform module that creates two lambda functions
that will create AMI automatically at regular intervals. It is based on
the code at
and
.
-
---
-This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
+This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
[][share_email]
[][share_googleplus]
[][share_facebook]
@@ -36,16 +57,46 @@ It's 100% Open Source and licensed under the [MIT](LICENSE).
-We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!
+We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!
+
+
+## Security & Compliance [](https://bridgecrew.io/)
+
+Security scanning is graciously provided by Bridgecrew. Bridgecrew is the leading fully hosted, cloud-native solution providing continuous Terraform security and compliance.
+
+| Benchmark | Description |
+|--------|---------------|
+| [![Infrastructure Security](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=INFRASTRUCTURE+SECURITY) | Infrastructure Security Compliance |
+| [![CIS KUBERNETES](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/cis_kubernetes)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=CIS+KUBERNETES+V1.5) | Center for Internet Security, KUBERNETES Compliance |
+| [![CIS AWS](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/cis_aws)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=CIS+AWS+V1.2) | Center for Internet Security, AWS Compliance |
+| [![CIS AZURE](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/cis_azure)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=CIS+AZURE+V1.1) | Center for Internet Security, AZURE Compliance |
+| [![PCI-DSS](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/pci)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=PCI-DSS+V3.2) | Payment Card Industry Data Security Standards Compliance |
+| [![NIST-800-53](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/nist)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=NIST-800-53) | National Institute of Standards and Technology Compliance |
+| [![ISO27001](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/iso)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=ISO27001) | Information Security Management System, ISO/IEC 27001 Compliance |
+| [![SOC2](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/soc2)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=SOC2)| Service Organization Control 2 Compliance |
+| [![CIS GCP](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/cis_gcp)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=CIS+GCP+V1.1) | Center for Internet Security, GCP Compliance |
+| [![HIPAA](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-ec2-ami-backup/hipaa)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-ec2-ami-backup&benchmark=HIPAA) | Health Insurance Portability and Accountability Compliance |
## Usage
+
+**IMPORTANT:** We do not pin modules to versions in our examples because of the
+difficulty of keeping the versions in the documentation in sync with the latest released versions.
+We highly recommend that in your code you pin the version to the exact version you are
+using so that your infrastructure remains stable, and update versions in a
+systematic way so that they do not catch you by surprise.
+
+Also, because of a bug in the Terraform registry ([hashicorp/terraform#21417](https://github.com/hashicorp/terraform/issues/21417)),
+the registry shows many of our inputs as required when in fact they are optional.
+The table below correctly indicates which inputs are required.
+
+
Include this repository as a module in your existing terraform code:
```hcl
@@ -90,8 +141,9 @@ module "lambda_ami_backup" {
+
## Makefile Targets
-```
+```text
Available targets:
help Help screen
@@ -100,33 +152,80 @@ Available targets:
lint Lint terraform code
```
+
+
+## Requirements
+
+No requirements.
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [archive](#provider\_archive) | n/a |
+| [aws](#provider\_aws) | n/a |
+| [null](#provider\_null) | n/a |
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [label](#module\_label) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+| [label\_backup](#module\_label\_backup) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+| [label\_cleanup](#module\_label\_cleanup) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+| [label\_role](#module\_label\_role) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+
+## Resources
+
+| Name | Type |
+|------|------|
+| [aws_cloudwatch_event_rule.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
+| [aws_cloudwatch_event_rule.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
+| [aws_cloudwatch_event_target.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
+| [aws_cloudwatch_event_target.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
+| [aws_iam_role.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
+| [aws_iam_role_policy.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
+| [aws_lambda_function.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
+| [aws_lambda_function.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
+| [aws_lambda_permission.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
+| [aws_lambda_permission.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
+| [null_resource.schedule](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
+| [archive_file.ami_backup](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
+| [archive_file.ami_cleanup](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
+| [aws_iam_policy_document.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
+| [aws_iam_policy_document.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
## Inputs
| Name | Description | Type | Default | Required |
-|------|-------------|:----:|:-----:|:-----:|
-| ami_owner | AWS Account ID which is used as a filter for AMI list (e.g. `123456789012`) | string | `` | no |
-| backup_schedule | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | string | `cron(00 19 * * ? *)` | no |
-| block_device_mappings | List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes | list | `` | no |
-| cleanup_schedule | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | string | `cron(05 19 * * ? *)` | no |
-| instance_id | AWS Instance ID which is used for creating the AMI image (e.g. `id-123456789012`) | string | - | yes |
-| name | Name (e.g. `bastion` or `db`) | string | `` | no |
-| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `` | no |
-| reboot | Reboot the machine as part of the snapshot process | string | `false` | no |
-| region | AWS Region where module should operate (e.g. `us-east-1`) | string | `` | no |
-| retention_days | Is the number of days you want to keep the backups for (e.g. `14`) | string | `14` | no |
-| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |
+|------|-------------|------|---------|:--------:|
+| [ami\_owner](#input\_ami\_owner) | AWS Account ID which is used as a filter for AMI list (e.g. `123456789012`) | `string` | `""` | no |
+| [backup\_schedule](#input\_backup\_schedule) | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | `string` | `"cron(00 19 * * ? *)"` | no |
+| [block\_device\_mappings](#input\_block\_device\_mappings) | List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes | `list(string)` | `[]` | no |
+| [cleanup\_schedule](#input\_cleanup\_schedule) | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | `string` | `"cron(05 19 * * ? *)"` | no |
+| [instance\_id](#input\_instance\_id) | AWS Instance ID which is used for creating the AMI image (e.g. `id-123456789012`) | `any` | n/a | yes |
+| [name](#input\_name) | Name (e.g. `bastion` or `db`) | `string` | `""` | no |
+| [namespace](#input\_namespace) | Namespace (e.g. `cp` or `cloudposse`) | `string` | `""` | no |
+| [reboot](#input\_reboot) | Reboot the machine as part of the snapshot process | `string` | `"false"` | no |
+| [region](#input\_region) | AWS Region where module should operate (e.g. `us-east-1`) | `string` | `""` | no |
+| [retention\_days](#input\_retention\_days) | Is the number of days you want to keep the backups for (e.g. `14`) | `string` | `"14"` | no |
+| [stage](#input\_stage) | Stage (e.g. `prod`, `dev`, `staging`) | `string` | `""` | no |
+## Outputs
+No outputs.
+
-## Share the Love
-Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-ec2-ami-backup)! (it helps us **a lot**)
+## Share the Love
+
+Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-ec2-ami-backup)! (it helps us **a lot**)
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
+
## Related Projects
Check out these related projects.
@@ -135,53 +234,60 @@ Check out these related projects.
- [terraform-aws-efs-backup](https://github.com/cloudposse/terraform-aws-efs-backup) - Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
-
-
## References
-For additional context, refer to some of these links.
+For additional context, refer to some of these links.
- [Terraform config for automatic EBS snapshots](https://github.com/chef/lambda_ebs_snapshot) - This repo contains a terraform configuration that creates two lambda functions that will take automatic EBS snapshots at regular intervals.
## Help
-**Got a question?**
+**Got a question?** We got answers.
File a GitHub [issue](https://github.com/cloudposse/terraform-aws-ec2-ami-backup/issues), send us an [email][email] or join our [Slack Community][slack].
[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
-## Commercial Support
-
-Work directly with our team of DevOps experts via email, slack, and video conferencing.
-
-We provide [*commercial support*][commercial_support] for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer.
-
-[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)][email]
+## DevOps Accelerator for Startups
-- **Questions.** We'll use a Shared Slack channel between your team and ours.
-- **Troubleshooting.** We'll help you triage why things aren't working.
-- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback.
-- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects.
-- **Build New Terraform Modules.** We'll [develop original modules][module_development] to provision infrastructure.
-- **Cloud Architecture.** We'll assist with your cloud strategy and design.
-- **Implementation.** We'll provide hands-on support to implement our reference architectures.
+We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.
+[![Learn More](https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge)][commercial_support]
-## Terraform Module Development
+Work directly with our team of DevOps experts via email, slack, and video conferencing.
-Are you interested in custom Terraform module development? Submit your inquiry using [our form][module_development] today and we'll get back to you ASAP.
+We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.
+- **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.
+- **Release Engineering.** You'll have end-to-end CI/CD with unlimited staging environments.
+- **Site Reliability Engineering.** You'll have total visibility into your apps and microservices.
+- **Security Baseline.** You'll have built-in governance with accountability and audit logs for all changes.
+- **GitOps.** You'll be able to operate your infrastructure via Pull Requests.
+- **Training.** You'll receive hands-on training so your team can operate what we build.
+- **Questions.** You'll have a direct line of communication between our teams via a Shared Slack channel.
+- **Troubleshooting.** You'll get help to triage when things aren't working.
+- **Code Reviews.** You'll receive constructive feedback on Pull Requests.
+- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.
## Slack Community
Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
+## Discourse Forums
+
+Participate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.
+
## Newsletter
-Signup for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
+Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
+
+## Office Hours
+
+[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!
+
+[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]
## Contributing
@@ -207,7 +313,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
## Copyrights
-Copyright © 2016-2018 [Chef Software, Inc](https://www.chef.io/)
+Copyright © 2016-2023 [Chef Software, Inc](https://www.chef.io/)
@@ -216,10 +322,11 @@ Copyright © 2016-2018 [Chef Software, Inc](https://www.chef.io/)
-## License
+## License
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
+```text
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -241,6 +348,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Source:
+```
@@ -259,7 +367,7 @@ This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? P
We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source].
-We offer [paid support][commercial_support] on all of our projects.
+We offer [paid support][commercial_support] on all of our projects.
Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.
@@ -267,53 +375,54 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
### Contributors
+
| [![Sergey Vasilyev][s2504s_avatar]][s2504s_homepage]
[Sergey Vasilyev][s2504s_homepage] | [![Mark Harrison][mivok_avatar]][mivok_homepage]
[Mark Harrison][mivok_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]
[Vladimir][SweetOps_homepage] | [![Tron Thongsringklee][thanandorn_avatar]][thanandorn_homepage]
[Tron Thongsringklee][thanandorn_homepage] | [![Raymond Butcher][raymondbutcher_avatar]][raymondbutcher_homepage]
[Raymond Butcher][raymondbutcher_homepage] | [![Anthony DeMartini][ademartini_avatar]][ademartini_homepage]
[Anthony DeMartini][ademartini_homepage] | [![Konstantin B][comeanother_avatar]][comeanother_homepage]
[Konstantin B][comeanother_homepage] | [![Seth Chisamore][schisamo_avatar]][schisamo_homepage]
[Seth Chisamore][schisamo_homepage] |
|---|---|---|---|---|---|---|---|
+
[s2504s_homepage]: https://github.com/s2504s
- [s2504s_avatar]: https://github.com/s2504s.png?size=150
+ [s2504s_avatar]: https://img.cloudposse.com/150x150/https://github.com/s2504s.png
[mivok_homepage]: https://github.com/mivok
- [mivok_avatar]: https://github.com/mivok.png?size=150
+ [mivok_avatar]: https://img.cloudposse.com/150x150/https://github.com/mivok.png
[SweetOps_homepage]: https://github.com/SweetOps
- [SweetOps_avatar]: https://github.com/SweetOps.png?size=150
+ [SweetOps_avatar]: https://img.cloudposse.com/150x150/https://github.com/SweetOps.png
[thanandorn_homepage]: https://github.com/thanandorn
- [thanandorn_avatar]: https://github.com/thanandorn.png?size=150
+ [thanandorn_avatar]: https://img.cloudposse.com/150x150/https://github.com/thanandorn.png
[raymondbutcher_homepage]: https://github.com/raymondbutcher
- [raymondbutcher_avatar]: https://github.com/raymondbutcher.png?size=150
+ [raymondbutcher_avatar]: https://img.cloudposse.com/150x150/https://github.com/raymondbutcher.png
[ademartini_homepage]: https://github.com/ademartini
- [ademartini_avatar]: https://github.com/ademartini.png?size=150
+ [ademartini_avatar]: https://img.cloudposse.com/150x150/https://github.com/ademartini.png
[comeanother_homepage]: https://github.com/comeanother
- [comeanother_avatar]: https://github.com/comeanother.png?size=150
+ [comeanother_avatar]: https://img.cloudposse.com/150x150/https://github.com/comeanother.png
[schisamo_homepage]: https://github.com/schisamo
- [schisamo_avatar]: https://github.com/schisamo.png?size=150
-
-
+ [schisamo_avatar]: https://img.cloudposse.com/150x150/https://github.com/schisamo.png
[![README Footer][readme_footer_img]][readme_footer_link]
[![Beacon][beacon]][website]
-
+
[logo]: https://cloudposse.com/logo-300x69.svg
- [docs]: https://cpco.io/docs
- [website]: https://cpco.io/homepage
- [github]: https://cpco.io/github
- [jobs]: https://cpco.io/jobs
- [hire]: https://cpco.io/hire
- [slack]: https://cpco.io/slack
- [linkedin]: https://cpco.io/linkedin
- [twitter]: https://cpco.io/twitter
- [testimonial]: https://cpco.io/leave-testimonial
- [newsletter]: https://cpco.io/newsletter
- [email]: https://cpco.io/email
- [commercial_support]: https://cpco.io/commercial-support
- [we_love_open_source]: https://cpco.io/we-love-open-source
- [module_development]: https://cpco.io/module-development
- [terraform_modules]: https://cpco.io/terraform-modules
- [readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/terraform-aws-ec2-ami-backup
- [readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-ec2-ami-backup
- [readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-ec2-ami-backup
- [readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-ec2-ami-backup
- [readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-ec2-ami-backup
- [readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-ec2-ami-backup
+ [docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=docs
+ [website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=website
+ [github]: https://cpco.io/github?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=github
+ [jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=jobs
+ [hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=hire
+ [slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=slack
+ [linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=linkedin
+ [twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=twitter
+ [testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=testimonial
+ [office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=office_hours
+ [newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=newsletter
+ [discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=discourse
+ [email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=email
+ [commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=commercial_support
+ [we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=we_love_open_source
+ [terraform_modules]: https://cpco.io/terraform-modules?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=terraform_modules
+ [readme_header_img]: https://cloudposse.com/readme/header/img
+ [readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=readme_header_link
+ [readme_footer_img]: https://cloudposse.com/readme/footer/img
+ [readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=readme_footer_link
+ [readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
+ [readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ec2-ami-backup&utm_content=readme_commercial_support_link
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-ec2-ami-backup&url=https://github.com/cloudposse/terraform-aws-ec2-ami-backup
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-ec2-ami-backup&url=https://github.com/cloudposse/terraform-aws-ec2-ami-backup
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-ec2-ami-backup
@@ -321,3 +430,4 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-ec2-ami-backup
[share_email]: mailto:?subject=terraform-aws-ec2-ami-backup&body=https://github.com/cloudposse/terraform-aws-ec2-ami-backup
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-ec2-ami-backup?pixel&cs=github&cm=readme&an=terraform-aws-ec2-ami-backup
+
diff --git a/docs/targets.md b/docs/targets.md
index 3d4be2a..3dce8b3 100644
--- a/docs/targets.md
+++ b/docs/targets.md
@@ -1,5 +1,6 @@
+
## Makefile Targets
-```
+```text
Available targets:
help Help screen
@@ -8,3 +9,4 @@ Available targets:
lint Lint terraform code
```
+
diff --git a/docs/terraform.md b/docs/terraform.md
index 9ff418f..e52d864 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -1,17 +1,62 @@
+
+## Requirements
+
+No requirements.
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [archive](#provider\_archive) | n/a |
+| [aws](#provider\_aws) | n/a |
+| [null](#provider\_null) | n/a |
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [label](#module\_label) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+| [label\_backup](#module\_label\_backup) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+| [label\_cleanup](#module\_label\_cleanup) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+| [label\_role](#module\_label\_role) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.3.7 |
+
+## Resources
+
+| Name | Type |
+|------|------|
+| [aws_cloudwatch_event_rule.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
+| [aws_cloudwatch_event_rule.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
+| [aws_cloudwatch_event_target.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
+| [aws_cloudwatch_event_target.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
+| [aws_iam_role.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
+| [aws_iam_role_policy.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
+| [aws_lambda_function.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
+| [aws_lambda_function.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
+| [aws_lambda_permission.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
+| [aws_lambda_permission.ami_cleanup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
+| [null_resource.schedule](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
+| [archive_file.ami_backup](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
+| [archive_file.ami_cleanup](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
+| [aws_iam_policy_document.ami_backup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
+| [aws_iam_policy_document.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
## Inputs
| Name | Description | Type | Default | Required |
-|------|-------------|:----:|:-----:|:-----:|
-| ami_owner | AWS Account ID which is used as a filter for AMI list (e.g. `123456789012`) | string | `` | no |
-| backup_schedule | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | string | `cron(00 19 * * ? *)` | no |
-| block_device_mappings | List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes | list | `` | no |
-| cleanup_schedule | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | string | `cron(05 19 * * ? *)` | no |
-| instance_id | AWS Instance ID which is used for creating the AMI image (e.g. `id-123456789012`) | string | - | yes |
-| name | Name (e.g. `bastion` or `db`) | string | `` | no |
-| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `` | no |
-| reboot | Reboot the machine as part of the snapshot process | string | `false` | no |
-| region | AWS Region where module should operate (e.g. `us-east-1`) | string | `` | no |
-| retention_days | Is the number of days you want to keep the backups for (e.g. `14`) | string | `14` | no |
-| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |
+|------|-------------|------|---------|:--------:|
+| [ami\_owner](#input\_ami\_owner) | AWS Account ID which is used as a filter for AMI list (e.g. `123456789012`) | `string` | `""` | no |
+| [backup\_schedule](#input\_backup\_schedule) | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | `string` | `"cron(00 19 * * ? *)"` | no |
+| [block\_device\_mappings](#input\_block\_device\_mappings) | List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes | `list(string)` | `[]` | no |
+| [cleanup\_schedule](#input\_cleanup\_schedule) | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | `string` | `"cron(05 19 * * ? *)"` | no |
+| [instance\_id](#input\_instance\_id) | AWS Instance ID which is used for creating the AMI image (e.g. `id-123456789012`) | `any` | n/a | yes |
+| [name](#input\_name) | Name (e.g. `bastion` or `db`) | `string` | `""` | no |
+| [namespace](#input\_namespace) | Namespace (e.g. `cp` or `cloudposse`) | `string` | `""` | no |
+| [reboot](#input\_reboot) | Reboot the machine as part of the snapshot process | `string` | `"false"` | no |
+| [region](#input\_region) | AWS Region where module should operate (e.g. `us-east-1`) | `string` | `""` | no |
+| [retention\_days](#input\_retention\_days) | Is the number of days you want to keep the backups for (e.g. `14`) | `string` | `"14"` | no |
+| [stage](#input\_stage) | Stage (e.g. `prod`, `dev`, `staging`) | `string` | `""` | no |
+
+## Outputs
+No outputs.
+
diff --git a/main.tf b/main.tf
index bc08d98..195c904 100644
--- a/main.tf
+++ b/main.tf
@@ -1,5 +1,5 @@
locals {
- module_relpath = "${substr(path.module, length(path.cwd) + 1, -1)}"
+ module_relpath = substr(path.module, length(path.cwd) + 1, -1)
}
data "aws_iam_policy_document" "default" {
@@ -62,52 +62,52 @@ data "archive_file" "ami_cleanup" {
module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.7"
- namespace = "${var.namespace}"
- stage = "${var.stage}"
- name = "${var.name}"
+ namespace = var.namespace
+ stage = var.stage
+ name = var.name
}
module "label_backup" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.7"
- namespace = "${var.namespace}"
- stage = "${var.stage}"
+ namespace = var.namespace
+ stage = var.stage
name = "${var.name}-backup-${var.instance_id}"
}
module "label_cleanup" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.7"
- namespace = "${var.namespace}"
- stage = "${var.stage}"
+ namespace = var.namespace
+ stage = var.stage
name = "${var.name}-cleanup-${var.instance_id}"
}
module "label_role" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.7"
- namespace = "${var.namespace}"
- stage = "${var.stage}"
+ namespace = var.namespace
+ stage = var.stage
name = "${var.name}-${var.instance_id}"
}
resource "aws_iam_role" "ami_backup" {
- name = "${module.label_role.id}"
- assume_role_policy = "${data.aws_iam_policy_document.default.json}"
+ name = module.label_role.id
+ assume_role_policy = data.aws_iam_policy_document.default.json
}
resource "aws_iam_role_policy" "ami_backup" {
- name = "${module.label_role.id}"
- role = "${aws_iam_role.ami_backup.id}"
- policy = "${data.aws_iam_policy_document.ami_backup.json}"
+ name = module.label_role.id
+ role = aws_iam_role.ami_backup.id
+ policy = data.aws_iam_policy_document.ami_backup.json
}
resource "aws_lambda_function" "ami_backup" {
- filename = "${data.archive_file.ami_backup.output_path}"
- function_name = "${module.label_backup.id}"
+ filename = data.archive_file.ami_backup.output_path
+ function_name = module.label_backup.id
description = "Automatically backup EC2 instance (create AMI)"
- role = "${aws_iam_role.ami_backup.arn}"
+ role = aws_iam_role.ami_backup.arn
timeout = 60
handler = "ami_backup.lambda_handler"
runtime = "python2.7"
- source_code_hash = "${data.archive_file.ami_backup.output_base64sha256}"
+ source_code_hash = data.archive_file.ami_backup.output_base64sha256
environment = {
variables = {
@@ -123,14 +123,14 @@ resource "aws_lambda_function" "ami_backup" {
}
resource "aws_lambda_function" "ami_cleanup" {
- filename = "${data.archive_file.ami_cleanup.output_path}"
- function_name = "${module.label_cleanup.id}"
+ filename = data.archive_file.ami_cleanup.output_path
+ function_name = module.label_cleanup.id
description = "Automatically remove AMIs that have expired (delete AMI)"
- role = "${aws_iam_role.ami_backup.arn}"
+ role = aws_iam_role.ami_backup.arn
timeout = 60
handler = "ami_cleanup.lambda_handler"
runtime = "python2.7"
- source_code_hash = "${data.archive_file.ami_cleanup.output_base64sha256}"
+ source_code_hash = data.archive_file.ami_cleanup.output_base64sha256
environment = {
variables = {
@@ -150,43 +150,43 @@ resource "null_resource" "schedule" {
}
resource "aws_cloudwatch_event_rule" "ami_backup" {
- name = "${module.label_backup.id}"
+ name = module.label_backup.id
description = "Schedule for AMI snapshot backups"
- schedule_expression = "${null_resource.schedule.triggers.backup}"
+ schedule_expression = null_resource.schedule.triggers.backup
depends_on = ["null_resource.schedule"]
}
resource "aws_cloudwatch_event_rule" "ami_cleanup" {
- name = "${module.label_cleanup.id}"
+ name = module.label_cleanup.id
description = "Schedule for AMI snapshot cleanup"
- schedule_expression = "${null_resource.schedule.triggers.cleanup}"
+ schedule_expression = null_resource.schedule.triggers.cleanup
depends_on = ["null_resource.schedule"]
}
resource "aws_cloudwatch_event_target" "ami_backup" {
- rule = "${aws_cloudwatch_event_rule.ami_backup.name}"
- target_id = "${module.label_backup.id}"
- arn = "${aws_lambda_function.ami_backup.arn}"
+ rule = aws_cloudwatch_event_rule.ami_backup.name
+ target_id = module.label_backup.id
+ arn = aws_lambda_function.ami_backup.arn
}
resource "aws_cloudwatch_event_target" "ami_cleanup" {
- rule = "${aws_cloudwatch_event_rule.ami_cleanup.name}"
- target_id = "${module.label_cleanup.id}"
- arn = "${aws_lambda_function.ami_cleanup.arn}"
+ rule = aws_cloudwatch_event_rule.ami_cleanup.name
+ target_id = module.label_cleanup.id
+ arn = aws_lambda_function.ami_cleanup.arn
}
resource "aws_lambda_permission" "ami_backup" {
- statement_id = "${module.label_backup.id}"
+ statement_id = module.label_backup.id
action = "lambda:InvokeFunction"
- function_name = "${aws_lambda_function.ami_backup.function_name}"
+ function_name = aws_lambda_function.ami_backup.function_name
principal = "events.amazonaws.com"
- source_arn = "${aws_cloudwatch_event_rule.ami_backup.arn}"
+ source_arn = aws_cloudwatch_event_rule.ami_backup.arn
}
resource "aws_lambda_permission" "ami_cleanup" {
- statement_id = "${module.label_cleanup.id}"
+ statement_id = module.label_cleanup.id
action = "lambda:InvokeFunction"
- function_name = "${aws_lambda_function.ami_cleanup.function_name}"
+ function_name = aws_lambda_function.ami_cleanup.function_name
principal = "events.amazonaws.com"
- source_arn = "${aws_cloudwatch_event_rule.ami_cleanup.arn}"
+ source_arn = aws_cloudwatch_event_rule.ami_cleanup.arn
}
diff --git a/variables.tf b/variables.tf
index b7c391d..a3e66c6 100644
--- a/variables.tf
+++ b/variables.tf
@@ -31,7 +31,7 @@ variable "instance_id" {
variable "block_device_mappings" {
description = "List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes "
- type = "list"
+ type = list(string)
default = []
}