Skip to content

Commit

Permalink
Adds aws ami owner (#7)
Browse files Browse the repository at this point in the history
* Adds owners to data.aws_ami.info

* bump label version

* Update readme correctly
  • Loading branch information
mcg authored and aknysh committed May 10, 2019
1 parent 368e156 commit 2b74c66
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are

## Usage


**IMPORTANT:** The `master` branch is used in `source` just as an example. In your code, do not pin to `master` because there may be breaking changes between releases.
Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest releases](https://github.com/cloudposse/terraform-aws-ec2-instance-group/releases).


Note: add `${var.ssh_key_pair}` private key to the `ssh agent`.

Include this repository as a module in your existing terraform code.
Expand All @@ -67,6 +72,7 @@ module "instance" {
stage = "prod"
name = "app"
ami = "ami-a4dc46db"
ami_owner = "099720109477"
ssh_key_pair = "${var.ssh_key_pair}"
instance_type = "${var.instance_type}"
vpc_id = "${var.vpc_id}"
Expand All @@ -86,6 +92,7 @@ module "kafka_instance" {
stage = "prod"
name = "app"
ami = "ami-a4dc46db"
ami_owner = "099720109477"
ssh_key_pair = "${var.ssh_key_pair}"
vpc_id = "${var.vpc_id}"
security_groups = ["${var.security_groups}"]
Expand Down Expand Up @@ -139,6 +146,7 @@ Available targets:
| additional_ips_count | Count of additional EIPs | string | `0` | no |
| allowed_ports | List of allowed ingress ports | list | `<list>` | no |
| ami | The AMI to use for the instance. | string | - | yes |
| ami_owner | Owner of the given AMI | string | - | yes |
| applying_period | The period in seconds over which the specified statistic is applied | string | `60` | no |
| assign_eip_address | Assign an Elastic IP address to the instance | string | `true` | no |
| associate_public_ip_address | Associate a public IP address with the instance | string | `true` | no |
Expand Down
2 changes: 2 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ usage: |-
stage = "prod"
name = "app"
ami = "ami-a4dc46db"
ami_owner = "099720109477"
ssh_key_pair = "${var.ssh_key_pair}"
instance_type = "${var.instance_type}"
vpc_id = "${var.vpc_id}"
Expand All @@ -89,6 +90,7 @@ usage: |-
stage = "prod"
name = "app"
ami = "ami-a4dc46db"
ami_owner = "099720109477"
ssh_key_pair = "${var.ssh_key_pair}"
vpc_id = "${var.vpc_id}"
security_groups = ["${var.security_groups}"]
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
| additional_ips_count | Count of additional EIPs | string | `0` | no |
| allowed_ports | List of allowed ingress ports | list | `<list>` | no |
| ami | The AMI to use for the instance. | string | - | yes |
| ami_owner | Owner of the given AMI | string | - | yes |
| applying_period | The period in seconds over which the specified statistic is applied | string | `60` | no |
| assign_eip_address | Assign an Elastic IP address to the instance | string | `true` | no |
| associate_public_ip_address | Associate a public IP address with the instance | string | `true` | no |
Expand Down
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ data "aws_ami" "info" {
name = "image-id"
values = ["${var.ami}"]
}

owners = ["${var.ami_owner}"]
}

# Apply the terraform-terraform-label module for this resource
module "label" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.1.2"
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.2.1"
namespace = "${var.namespace}"
stage = "${var.stage}"
name = "${var.name}"
Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ variable "ami" {
description = "The AMI to use for the instance."
}

variable "ami_owner" {
description = "Owner of the given AMI"
}

variable "ebs_optimized" {
description = "Launched EC2 instance will be EBS-optimized"
default = "false"
Expand Down

0 comments on commit 2b74c66

Please sign in to comment.