https://github.com/gbvanrenswoude/terraform-share-ami-module
A Terraform module for sharing AMI using Image Permissions
https://github.com/gbvanrenswoude/terraform-share-ami-module
ami aws module permissions share terraform
Last synced: about 2 months ago
JSON representation
A Terraform module for sharing AMI using Image Permissions
- Host: GitHub
- URL: https://github.com/gbvanrenswoude/terraform-share-ami-module
- Owner: gbvanrenswoude
- Created: 2021-03-02T10:04:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-02T10:43:05.000Z (over 5 years ago)
- Last Synced: 2025-06-30T14:05:02.668Z (about 1 year ago)
- Topics: ami, aws, module, permissions, share, terraform
- Language: HCL
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform-share-ami-module
A Terraform module for sharing AMI using Image Permissions. It tracks the newest n number of AMIs automatically and shares the new ones with your customer AWS accounts and unshares the old / unsupported ones.
## What does the module do
This module fetches a list of AMIs in your account using the AMI datasource. It sorts them on date of creation, with the newest first and the oldest last.
Then it loops thru the newest n and makes sure they are shared with the . It will in this way automatically unshare the old AMIs and share new AMIs with a backwards support of n .
Example implementation:
```hcl
module "ami_share" {
source = "../"
ami_name_filter = "whoo-these-are-the-amis-i-build*"
ami_owner_filter = "616116116661" // its me I produce AMIs in this account !
accounts_to_share_with = {
customer1 = "616116116662" // my customers !
customer2 = "616116116663"
customer3 = "616116116664"
}
}
```
If you build your AMI encrypted, make sure to add grants to the KMS key for the automation roles that your customers use to spin up your AMIs.