Skip to content

Commit

Permalink
Use default subnet and SG names
Browse files Browse the repository at this point in the history
If no subnet_id is specified and a default subnet exists in the Default
VPC, the instance will be automatically created in the default subnet.

Using SG names instead of IDs should also resolve the issue where
`terraform plan` is not clean after a cranehost is created.

See this issue for additional details: hashicorp/terraform-provider-aws#1993
  • Loading branch information
dhinus committed Jan 5, 2018
1 parent f6c4093 commit ae49f19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 1 addition & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ resource "aws_instance" "instance" {
ami = "${coalesce(var.ami, data.aws_ami.ami.image_id)}"
instance_type = "${var.instance_type}"
key_name = "${var.ssh_key_name}"
subnet_id = "${var.subnet_id}"
security_groups = ["${aws_security_group.sg.id}"]
security_groups = ["${aws_security_group.sg.name}"]
associate_public_ip_address = true

tags {
Expand Down
6 changes: 1 addition & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ variable region {
default = "eu-west-1"
}

variable subnet_id {
description = "Subnet Id (default for buildo: subnet-789e130f, omnilab: subnet-13126d4a)"
}

variable volume_size {
description = "Volume size"
default = 8
Expand Down Expand Up @@ -60,4 +56,4 @@ variable disk_utilization_alarm_threshold {
variable bellosguardo_target {
description = "Possible values are 'buildo', 'omnilab'"
}
}

0 comments on commit ae49f19

Please sign in to comment.