Skip to content

Use owners with data.aws_ami.info #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,22 @@ Available targets:
lint Lint terraform code

```

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| 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. By default it is the AMI provided by Amazon with Ubuntu 16.04 | string | `` | no |
| ami_owner | Owner of the given AMI (ignored if `ami` unset) | string | `` | no |
| 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 |
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
| availability_zone | Availability Zone the instance is launched in. If not set, will be launched in the first AZ of the region | string | `` | no |
| comparison_operator | The arithmetic operation to use when comparing the specified Statistic and Threshold. Possible values are: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold. | string | `GreaterThanOrEqualToThreshold` | no |
| create_default_security_group | Create default Security Group with only Egress traffic allowed | string | `true` | no |
| default_alarm_action | | string | `action/actions/AWS_EC2.InstanceId.Reboot/1.0` | no |
| default_alarm_action | - | string | `action/actions/AWS_EC2.InstanceId.Reboot/1.0` | no |
| delete_on_termination | Whether the volume should be destroyed on instance termination | string | `true` | no |
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
| disable_api_termination | Enable EC2 Instance Termination Protection | string | `false` | no |
Expand Down Expand Up @@ -152,7 +152,7 @@ Available targets:
| tags | Additional tags | map | `<map>` | no |
| user_data | Instance user data. Do not pass gzip-compressed data via this argument | string | `` | no |
| vpc_id | The ID of the VPC that the instance security group belongs to | string | - | yes |
| welcome_message | | string | `` | no |
| welcome_message | - | string | `` | no |

## Outputs

Expand Down Expand Up @@ -263,7 +263,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

## Copyright

Copyright © 2017-2018 [Cloud Posse, LLC](https://cpco.io/copyright)
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)



Expand Down
6 changes: 3 additions & 3 deletions docs/terraform.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| 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. By default it is the AMI provided by Amazon with Ubuntu 16.04 | string | `` | no |
| ami_owner | Owner of the given AMI (ignored if `ami` unset) | string | `` | no |
| 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 |
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
| availability_zone | Availability Zone the instance is launched in. If not set, will be launched in the first AZ of the region | string | `` | no |
| comparison_operator | The arithmetic operation to use when comparing the specified Statistic and Threshold. Possible values are: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold. | string | `GreaterThanOrEqualToThreshold` | no |
| create_default_security_group | Create default Security Group with only Egress traffic allowed | string | `true` | no |
| default_alarm_action | | string | `action/actions/AWS_EC2.InstanceId.Reboot/1.0` | no |
| default_alarm_action | - | string | `action/actions/AWS_EC2.InstanceId.Reboot/1.0` | no |
| delete_on_termination | Whether the volume should be destroyed on instance termination | string | `true` | no |
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
| disable_api_termination | Enable EC2 Instance Termination Protection | string | `false` | no |
Expand Down Expand Up @@ -48,7 +48,7 @@
| tags | Additional tags | map | `<map>` | no |
| user_data | Instance user data. Do not pass gzip-compressed data via this argument | string | `` | no |
| vpc_id | The ID of the VPC that the instance security group belongs to | string | - | yes |
| welcome_message | | string | `` | no |
| welcome_message | - | string | `` | no |

## Outputs

Expand Down
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
ebs_iops = "${var.ebs_volume_type == "io1" ? var.ebs_iops : "0"}"
availability_zone = "${var.availability_zone != "" ? var.availability_zone : data.aws_subnet.default.availability_zone}"
ami = "${var.ami != "" ? var.ami : data.aws_ami.default.image_id}"
ami_owner = "${var.ami != "" ? var.ami_owner : data.aws_ami.default.owner_id}"
root_volume_type = "${var.root_volume_type != "" ? var.root_volume_type : data.aws_ami.info.root_device_type}"
public_dns = "${var.associate_public_ip_address == "true" && var.assign_eip_address == "true" && var.instance_enabled == "true" ? data.null_data_source.eip.outputs["public_dns"] : join("", aws_instance.default.*.public_dns)}"
}
Expand Down Expand Up @@ -56,6 +57,8 @@ data "aws_ami" "info" {
name = "image-id"
values = ["${local.ami}"]
}

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

module "label" {
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ variable "ami" {
default = ""
}

variable "ami_owner" {
description = "Owner of the given AMI (ignored if `ami` unset)"
default = ""
}

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