Skip to content

Commit 085ec05

Browse files
johncblandiiaknysh
authored andcommitted
Feature releases (#57)
* Allow aws:elasticbeanstalk:managedactions toggling * Remove duplicate DeploymentPolicy setting * Add support for CloudWatch health log streaming * Updated documentation * Rebuild README * Add all beanstalk outputs * Documentation updates * Add description variable and fix for boolean values * Remove description output It is listed in the documentation but fails every time. It isn’t a critical output anyway. Error: Error running plan: 1 error(s) occurred: * module.elastic_beanstalk_environment.output.description: Resource 'aws_elastic_beanstalk_environment.default' does not have attribute 'description' for variable 'aws_elastic_beanstalk_environment.default.description' * Documentation update * Updated enable_managed_actions documentation * tf fmt
1 parent b9a86d8 commit 085ec05

File tree

5 files changed

+136
-6
lines changed

5 files changed

+136
-6
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,15 @@ Available targets:
6868
| config_document | A JSON document describing the environment and instance metrics to publish to CloudWatch. | string | `{ "CloudWatchMetrics": {}, "Version": 1}` | no |
6969
| config_source | S3 source for config | string | `` | no |
7070
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
71+
| description | Short description of the Environment | string | `` | no |
72+
| enable_managed_actions | Enable managed platform updates. When you set this to true, you must also specify a `PreferredStartTime` and `UpdateLevel` | string | `true` | no |
7173
| env_default_key | Default ENV variable key for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `DEFAULT_ENV_%d` | no |
7274
| env_default_value | Default ENV variable value for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `UNSET` | no |
7375
| 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 |
7476
| force_destroy | Destroy S3 bucket for load balancer logs | string | `false` | no |
77+
| 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 |
78+
| 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 |
79+
| health_streaming_retention_in_days | The number of days to keep the archived health data before it expires. | string | `7` | no |
7580
| healthcheck_url | Application Health Check URL. Elastic Beanstalk will call this URL to check the health of the application running on EC2 instances | string | `/healthcheck` | no |
7681
| http_listener_enabled | Enable port 80 (http) | string | `false` | no |
7782
| instance_refresh_enabled | Enable weekly instance replacement. | string | `true` | no |
@@ -114,12 +119,24 @@ Available targets:
114119

115120
| Name | Description |
116121
|------|-------------|
122+
| all_settings | List of all option settings configured in the environment. These are a combination of default settings and their overrides from setting in the configuration. |
123+
| application | The Elastic Beanstalk Application specified for this environment. |
124+
| autoscaling_groups | The autoscaling groups used by this environment. |
125+
| cname | Fully qualified DNS name for the environment. |
117126
| ec2_instance_profile_role_name | Instance IAM role name |
118127
| elb_dns_name | ELB technical host |
119128
| elb_zone_id | ELB zone id |
120129
| host | DNS hostname |
130+
| id | ID of the Elastic Beanstalk environment. |
131+
| instances | Instances used by this environment. |
132+
| launch_configurations | Launch configurations in use by this environment. |
133+
| load_balancers | Elastic Load Balancers in use by this environment. |
121134
| name | Name |
135+
| queues | SQS queues in use by this environment. |
122136
| security_group_id | Security group id |
137+
| setting | Settings specifically set for this environment. |
138+
| tier | The environment tier specified. |
139+
| triggers | Autoscaling triggers in use by this environment. |
123140

124141

125142

docs/terraform.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@
2020
| config_document | A JSON document describing the environment and instance metrics to publish to CloudWatch. | string | `{ "CloudWatchMetrics": {}, "Version": 1}` | no |
2121
| config_source | S3 source for config | string | `` | no |
2222
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
23+
| description | Short description of the Environment | string | `` | no |
24+
| enable_managed_actions | Enable managed platform updates. When you set this to true, you must also specify a `PreferredStartTime` and `UpdateLevel` | string | `true` | no |
2325
| env_default_key | Default ENV variable key for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `DEFAULT_ENV_%d` | no |
2426
| env_default_value | Default ENV variable value for Elastic Beanstalk `aws:elasticbeanstalk:application:environment` setting | string | `UNSET` | no |
2527
| 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 |
2628
| force_destroy | Destroy S3 bucket for load balancer logs | string | `false` | no |
29+
| 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 |
30+
| 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 |
31+
| health_streaming_retention_in_days | The number of days to keep the archived health data before it expires. | string | `7` | no |
2732
| healthcheck_url | Application Health Check URL. Elastic Beanstalk will call this URL to check the health of the application running on EC2 instances | string | `/healthcheck` | no |
2833
| http_listener_enabled | Enable port 80 (http) | string | `false` | no |
2934
| instance_refresh_enabled | Enable weekly instance replacement. | string | `true` | no |
@@ -66,10 +71,22 @@
6671

6772
| Name | Description |
6873
|------|-------------|
74+
| all_settings | List of all option settings configured in the environment. These are a combination of default settings and their overrides from setting in the configuration. |
75+
| application | The Elastic Beanstalk Application specified for this environment. |
76+
| autoscaling_groups | The autoscaling groups used by this environment. |
77+
| cname | Fully qualified DNS name for the environment. |
6978
| ec2_instance_profile_role_name | Instance IAM role name |
7079
| elb_dns_name | ELB technical host |
7180
| elb_zone_id | ELB zone id |
7281
| host | DNS hostname |
82+
| id | ID of the Elastic Beanstalk environment. |
83+
| instances | Instances used by this environment. |
84+
| launch_configurations | Launch configurations in use by this environment. |
85+
| load_balancers | Elastic Load Balancers in use by this environment. |
7386
| name | Name |
87+
| queues | SQS queues in use by this environment. |
7488
| security_group_id | Security group id |
89+
| setting | Settings specifically set for this environment. |
90+
| tier | The environment tier specified. |
91+
| triggers | Autoscaling triggers in use by this environment. |
7592

main.tf

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ resource "aws_security_group" "default" {
329329
resource "aws_elastic_beanstalk_environment" "default" {
330330
name = "${module.label.id}"
331331
application = "${var.app}"
332+
description = "${var.description}"
332333

333334
tier = "${var.tier}"
334335
solution_stack_name = "${var.solution_stack_name}"
@@ -603,6 +604,21 @@ resource "aws_elastic_beanstalk_environment" "default" {
603604
name = "SSLCertificateArns"
604605
value = "${var.loadbalancer_certificate_arn}"
605606
}
607+
setting {
608+
namespace = "aws:elasticbeanstalk:cloudwatch:logs:health"
609+
name = "HealthStreamingEnabled"
610+
value = "${var.health_streaming_enabled ? "true" : "false"}"
611+
}
612+
setting {
613+
namespace = "aws:elasticbeanstalk:cloudwatch:logs:health"
614+
name = "DeleteOnTerminate"
615+
value = "${var.health_streaming_delete_on_terminate ? "true" : "false"}"
616+
}
617+
setting {
618+
namespace = "aws:elasticbeanstalk:cloudwatch:logs:health"
619+
name = "RetentionInDays"
620+
value = "${var.health_streaming_retention_in_days}"
621+
}
606622
setting {
607623
namespace = "aws:elasticbeanstalk:healthreporting:system"
608624
name = "ConfigDocument"
@@ -638,11 +654,6 @@ resource "aws_elastic_beanstalk_environment" "default" {
638654
name = "BatchSize"
639655
value = "1"
640656
}
641-
setting {
642-
namespace = "aws:elasticbeanstalk:command"
643-
name = "DeploymentPolicy"
644-
value = "Rolling"
645-
}
646657
setting {
647658
namespace = "aws:elasticbeanstalk:application:environment"
648659
name = "BASE_HOST"
@@ -656,7 +667,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
656667
setting {
657668
namespace = "aws:elasticbeanstalk:managedactions"
658669
name = "ManagedActionsEnabled"
659-
value = "true"
670+
value = "${var.enable_managed_actions ? "true" : "false"}"
660671
}
661672
setting {
662673
namespace = "aws:elasticbeanstalk:managedactions"

outputs.tf

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ output "host" {
33
description = "DNS hostname"
44
}
55

6+
output "id" {
7+
description = "ID of the Elastic Beanstalk environment."
8+
value = "${aws_elastic_beanstalk_environment.default.id}"
9+
}
10+
611
output "name" {
712
value = "${aws_elastic_beanstalk_environment.default.name}"
813
description = "Name"
@@ -27,3 +32,58 @@ output "ec2_instance_profile_role_name" {
2732
value = "${aws_iam_role.ec2.name}"
2833
description = "Instance IAM role name"
2934
}
35+
36+
output "tier" {
37+
description = "The environment tier specified."
38+
value = "${aws_elastic_beanstalk_environment.default.tier}"
39+
}
40+
41+
output "application" {
42+
description = "The Elastic Beanstalk Application specified for this environment."
43+
value = "${aws_elastic_beanstalk_environment.default.application}"
44+
}
45+
46+
output "setting" {
47+
description = "Settings specifically set for this environment."
48+
value = "${aws_elastic_beanstalk_environment.default.setting}"
49+
}
50+
51+
output "all_settings" {
52+
description = "List of all option settings configured in the environment. These are a combination of default settings and their overrides from setting in the configuration."
53+
value = "${aws_elastic_beanstalk_environment.default.all_settings}"
54+
}
55+
56+
output "cname" {
57+
description = "Fully qualified DNS name for the environment."
58+
value = "${aws_elastic_beanstalk_environment.default.cname}"
59+
}
60+
61+
output "autoscaling_groups" {
62+
description = "The autoscaling groups used by this environment."
63+
value = "${aws_elastic_beanstalk_environment.default.autoscaling_groups}"
64+
}
65+
66+
output "instances" {
67+
description = "Instances used by this environment."
68+
value = "${aws_elastic_beanstalk_environment.default.instances}"
69+
}
70+
71+
output "launch_configurations" {
72+
description = "Launch configurations in use by this environment."
73+
value = "${aws_elastic_beanstalk_environment.default.launch_configurations}"
74+
}
75+
76+
output "load_balancers" {
77+
description = "Elastic Load Balancers in use by this environment."
78+
value = "${aws_elastic_beanstalk_environment.default.load_balancers}"
79+
}
80+
81+
output "queues" {
82+
description = "SQS queues in use by this environment."
83+
value = "${aws_elastic_beanstalk_environment.default.queues}"
84+
}
85+
86+
output "triggers" {
87+
description = "Autoscaling triggers in use by this environment."
88+
value = "${aws_elastic_beanstalk_environment.default.triggers}"
89+
}

variables.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,31 @@ variable "name" {
2525
description = "Solution name, e.g. 'app' or 'jenkins'"
2626
}
2727

28+
variable "description" {
29+
default = ""
30+
description = "Short description of the Environment"
31+
}
32+
2833
variable "config_document" {
2934
default = "{ \"CloudWatchMetrics\": {}, \"Version\": 1}"
3035
description = "A JSON document describing the environment and instance metrics to publish to CloudWatch."
3136
}
3237

38+
variable "health_streaming_enabled" {
39+
default = false
40+
description = "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."
41+
}
42+
43+
variable "health_streaming_delete_on_terminate" {
44+
default = false
45+
description = "Whether to delete the log group when the environment is terminated. If false, the health data is kept RetentionInDays days."
46+
}
47+
48+
variable "health_streaming_retention_in_days" {
49+
default = "7"
50+
description = "The number of days to keep the archived health data before it expires."
51+
}
52+
3353
variable "healthcheck_url" {
3454
default = "/healthcheck"
3555
description = "Application Health Check URL. Elastic Beanstalk will call this URL to check the health of the application running on EC2 instances"
@@ -102,6 +122,11 @@ variable "config_source" {
102122
description = "S3 source for config"
103123
}
104124

125+
variable "enable_managed_actions" {
126+
default = true
127+
description = "Enable managed platform updates. When you set this to true, you must also specify a `PreferredStartTime` and `UpdateLevel`"
128+
}
129+
105130
variable "preferred_start_time" {
106131
default = "Sun:10:00"
107132
description = "Configure a maintenance window for managed actions in UTC"

0 commit comments

Comments
 (0)