Skip to content

Commit c50fcd1

Browse files
skolsuperaknysh
authored andcommitted
Add option to specify environment type (#65)
* Add an option to specify environment type * Update README * Classic typo * Update doc * Update doc some more * make readme * More doc updates * Remove unused settings in SingleInstance environment They get ignored by ElasticBeanstalk anyway, but they trigger a noisy plan when terraform keeps trying to add them * Revert these "fixes", they might be wrong * Document `wait_for_ready_timeout` * Revert "Remove unused settings in SingleInstance environment" This reverts commit c9a9cb4
1 parent a78ee15 commit c50fcd1

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Available targets:
9090
| env_default_key | Default ENV variable key for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `DEFAULT_ENV_%d` | no |
9191
| env_default_value | Default ENV variable value for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `UNSET` | no |
9292
| env_vars | Map of custom ENV variables to be provided to the Jenkins application running on Elastic Beanstalk, e.g. `env_vars = { JENKINS_USER = 'admin' JENKINS_PASS = 'xxxxxx' }` | map | `<map>` | no |
93+
| environment_type | Environment type, e.g. 'LoadBalanced' or 'SingleInstance'. If setting to 'SingleInstance', `rolling_update_type` must be set to 'Time', `updating_min_in_service` must be set to 0, and `public_subnets` will be unused (it applies to the ELB, which does not exist in SingleInstance environments) | string | `LoadBalanced` | no |
9394
| force_destroy | Destroy S3 bucket for load balancer logs | string | `false` | no |
9495
| health_streaming_delete_on_terminate | Whether to delete the log group when the environment is terminated. If false, the health data is kept RetentionInDays days. | string | `false` | no |
9596
| health_streaming_enabled | For environments with enhanced health reporting enabled, whether to create a group in CloudWatch Logs for environment health and archive Elastic Beanstalk environment health data. For information about enabling enhanced health, see aws:elasticbeanstalk:healthreporting:system. | string | `false` | no |
@@ -132,7 +133,7 @@ Available targets:
132133
| updating_min_in_service | Minimum count of instances up during update | string | `1` | no |
133134
| version_label | Elastic Beanstalk Application version to deploy | string | `` | no |
134135
| vpc_id | ID of the VPC in which to provision the AWS resources | string | - | yes |
135-
| wait_for_ready_timeout | - | string | `20m` | no |
136+
| wait_for_ready_timeout | The maximum duration that Terraform should wait for an Elastic Beanstalk Environment to be in a ready state before timing out. | string | `20m` | no |
136137
| zone_id | Route53 parent zone ID. The module will create sub-domain DNS records in the parent zone for the EB environment | string | `` | no |
137138

138139
## Outputs

docs/terraform.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
| env_default_key | Default ENV variable key for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `DEFAULT_ENV_%d` | no |
2828
| env_default_value | Default ENV variable value for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `UNSET` | no |
2929
| env_vars | Map of custom ENV variables to be provided to the Jenkins application running on Elastic Beanstalk, e.g. `env_vars = { JENKINS_USER = 'admin' JENKINS_PASS = 'xxxxxx' }` | map | `<map>` | no |
30+
| environment_type | Environment type, e.g. 'LoadBalanced' or 'SingleInstance'. If setting to 'SingleInstance', `rolling_update_type` must be set to 'Time', `updating_min_in_service` must be set to 0, and `public_subnets` will be unused (it applies to the ELB, which does not exist in SingleInstance environments) | string | `LoadBalanced` | no |
3031
| force_destroy | Destroy S3 bucket for load balancer logs | string | `false` | no |
3132
| health_streaming_delete_on_terminate | Whether to delete the log group when the environment is terminated. If false, the health data is kept RetentionInDays days. | string | `false` | no |
3233
| health_streaming_enabled | For environments with enhanced health reporting enabled, whether to create a group in CloudWatch Logs for environment health and archive Elastic Beanstalk environment health data. For information about enabling enhanced health, see aws:elasticbeanstalk:healthreporting:system. | string | `false` | no |
@@ -69,7 +70,7 @@
6970
| updating_min_in_service | Minimum count of instances up during update | string | `1` | no |
7071
| version_label | Elastic Beanstalk Application version to deploy | string | `` | no |
7172
| vpc_id | ID of the VPC in which to provision the AWS resources | string | - | yes |
72-
| wait_for_ready_timeout | - | string | `20m` | no |
73+
| wait_for_ready_timeout | The maximum duration that Terraform should wait for an Elastic Beanstalk Environment to be in a ready state before timing out. | string | `20m` | no |
7374
| zone_id | Route53 parent zone ID. The module will create sub-domain DNS records in the parent zone for the EB environment | string | `` | no |
7475

7576
## Outputs

main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,11 @@ resource "aws_elastic_beanstalk_environment" "default" {
658658
name = "Application Healthcheck URL"
659659
value = "HTTP:80${var.healthcheck_url}"
660660
}
661+
setting {
662+
namespace = "aws:elasticbeanstalk:environment"
663+
name = "EnvironmentType"
664+
value = "${var.environment_type}"
665+
}
661666
setting {
662667
namespace = "aws:elasticbeanstalk:environment"
663668
name = "LoadBalancerType"

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ variable "logs_retention_in_days" {
100100
description = "The number of days to keep log events before they expire."
101101
}
102102

103+
variable "environment_type" {
104+
default = "LoadBalanced"
105+
description = "Environment type, e.g. 'LoadBalanced' or 'SingleInstance'. If setting to 'SingleInstance', `rolling_update_type` must be set to 'Time', `updating_min_in_service` must be set to 0, and `public_subnets` will be unused (it applies to the ELB, which does not exist in SingleInstance environments)"
106+
}
107+
103108
variable "loadbalancer_type" {
104109
default = "classic"
105110
description = "Load Balancer type, e.g. 'application' or 'classic'"
@@ -295,7 +300,8 @@ variable "solution_stack_name" {
295300
}
296301

297302
variable "wait_for_ready_timeout" {
298-
default = "20m"
303+
default = "20m"
304+
description = "The maximum duration that Terraform should wait for an Elastic Beanstalk Environment to be in a ready state before timing out."
299305
}
300306

301307
# From: http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region

0 commit comments

Comments
 (0)