Skip to content

Commit 2b74c66

Browse files
mcgaknysh
authored andcommitted
Adds aws ami owner (#7)
* Adds owners to data.aws_ami.info * bump label version * Update readme correctly
1 parent 368e156 commit 2b74c66

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are
5353

5454
## Usage
5555

56+
57+
**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.
58+
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).
59+
60+
5661
Note: add `${var.ssh_key_pair}` private key to the `ssh agent`.
5762

5863
Include this repository as a module in your existing terraform code.
@@ -67,6 +72,7 @@ module "instance" {
6772
stage = "prod"
6873
name = "app"
6974
ami = "ami-a4dc46db"
75+
ami_owner = "099720109477"
7076
ssh_key_pair = "${var.ssh_key_pair}"
7177
instance_type = "${var.instance_type}"
7278
vpc_id = "${var.vpc_id}"
@@ -86,6 +92,7 @@ module "kafka_instance" {
8692
stage = "prod"
8793
name = "app"
8894
ami = "ami-a4dc46db"
95+
ami_owner = "099720109477"
8996
ssh_key_pair = "${var.ssh_key_pair}"
9097
vpc_id = "${var.vpc_id}"
9198
security_groups = ["${var.security_groups}"]
@@ -139,6 +146,7 @@ Available targets:
139146
| additional_ips_count | Count of additional EIPs | string | `0` | no |
140147
| allowed_ports | List of allowed ingress ports | list | `<list>` | no |
141148
| ami | The AMI to use for the instance. | string | - | yes |
149+
| ami_owner | Owner of the given AMI | string | - | yes |
142150
| applying_period | The period in seconds over which the specified statistic is applied | string | `60` | no |
143151
| assign_eip_address | Assign an Elastic IP address to the instance | string | `true` | no |
144152
| associate_public_ip_address | Associate a public IP address with the instance | string | `true` | no |

README.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ usage: |-
7070
stage = "prod"
7171
name = "app"
7272
ami = "ami-a4dc46db"
73+
ami_owner = "099720109477"
7374
ssh_key_pair = "${var.ssh_key_pair}"
7475
instance_type = "${var.instance_type}"
7576
vpc_id = "${var.vpc_id}"
@@ -89,6 +90,7 @@ usage: |-
8990
stage = "prod"
9091
name = "app"
9192
ami = "ami-a4dc46db"
93+
ami_owner = "099720109477"
9294
ssh_key_pair = "${var.ssh_key_pair}"
9395
vpc_id = "${var.vpc_id}"
9496
security_groups = ["${var.security_groups}"]

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| additional_ips_count | Count of additional EIPs | string | `0` | no |
66
| allowed_ports | List of allowed ingress ports | list | `<list>` | no |
77
| ami | The AMI to use for the instance. | string | - | yes |
8+
| ami_owner | Owner of the given AMI | string | - | yes |
89
| applying_period | The period in seconds over which the specified statistic is applied | string | `60` | no |
910
| assign_eip_address | Assign an Elastic IP address to the instance | string | `true` | no |
1011
| associate_public_ip_address | Associate a public IP address with the instance | string | `true` | no |

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ data "aws_ami" "info" {
3636
name = "image-id"
3737
values = ["${var.ami}"]
3838
}
39+
40+
owners = ["${var.ami_owner}"]
3941
}
4042

4143
# Apply the terraform-terraform-label module for this resource
4244
module "label" {
43-
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.1.2"
45+
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.2.1"
4446
namespace = "${var.namespace}"
4547
stage = "${var.stage}"
4648
name = "${var.name}"

variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ variable "ami" {
9595
description = "The AMI to use for the instance."
9696
}
9797

98+
variable "ami_owner" {
99+
description = "Owner of the given AMI"
100+
}
101+
98102
variable "ebs_optimized" {
99103
description = "Launched EC2 instance will be EBS-optimized"
100104
default = "false"

0 commit comments

Comments
 (0)