Skip to content

Commit aa3b042

Browse files
jackmahoneyaknysh
authored andcommitted
Add variable for application port and remove hard-coded values (#76)
* add application port variable * rebuilt README to reflect new application port variables
1 parent c7f9729 commit aa3b042

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Available targets:
6767
|------|-------------|:----:|:-----:|:-----:|
6868
| alb_zone_id | ALB zone id | map | `<map>` | no |
6969
| app | EBS application name | string | - | yes |
70+
| application_port | Port application is listening on | string | `80` | no |
7071
| associate_public_ip_address | Specifies whether to launch instances in your VPC with public IP addresses. | string | `false` | no |
7172
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
7273
| autoscale_lower_bound | Minimum level of autoscale metric to remove an instance | string | `20` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
|------|-------------|:----:|:-----:|:-----:|
55
| alb_zone_id | ALB zone id | map | `<map>` | no |
66
| app | EBS application name | string | - | yes |
7+
| application_port | Port application is listening on | string | `80` | no |
78
| associate_public_ip_address | Specifies whether to launch instances in your VPC with public IP addresses. | string | `false` | no |
89
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
910
| autoscale_lower_bound | Minimum level of autoscale metric to remove an instance | string | `20` | no |

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
556556
setting {
557557
namespace = "aws:elb:listener"
558558
name = "InstancePort"
559-
value = "80"
559+
value = "${var.application_port}"
560560
}
561561
setting {
562562
namespace = "aws:elb:listener"
@@ -571,7 +571,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
571571
setting {
572572
namespace = "aws:elb:listener:443"
573573
name = "InstancePort"
574-
value = "80"
574+
value = "${var.application_port}"
575575
}
576576
setting {
577577
namespace = "aws:elb:listener:443"
@@ -661,7 +661,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
661661
setting {
662662
namespace = "aws:elasticbeanstalk:application"
663663
name = "Application Healthcheck URL"
664-
value = "HTTP:80${var.healthcheck_url}"
664+
value = "HTTP:${var.application_port}${var.healthcheck_url}"
665665
}
666666
setting {
667667
namespace = "aws:elasticbeanstalk:environment"
@@ -991,7 +991,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
991991
setting {
992992
namespace = "aws:elasticbeanstalk:environment:process:default"
993993
name = "Port"
994-
value = "80"
994+
value = "${var.application_port}"
995995
}
996996
setting {
997997
namespace = "aws:elasticbeanstalk:environment:process:default"

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ variable "http_listener_enabled" {
137137
description = "Enable port 80 (http)"
138138
}
139139

140+
variable "application_port" {
141+
default = "80"
142+
description = "Port application is listening on"
143+
}
144+
140145
variable "ssh_listener_enabled" {
141146
default = "false"
142147
description = "Enable ssh port"

0 commit comments

Comments
 (0)