Skip to content

Commit a78ee15

Browse files
skolsuperaknysh
authored andcommitted
Add flag to specify whether to use enhanced reporting (#64)
* Add flag to specify enhanced reporting or not * Conditionally create service-role for EnhancedHealth * Update README * Update doc * make readme
1 parent 904dc86 commit a78ee15

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Available targets:
6161
lint Lint terraform code
6262
6363
```
64-
6564
## Inputs
6665

6766
| Name | Description | Type | Default | Required |
@@ -87,6 +86,7 @@ Available targets:
8786
| enable_log_publication_control | Copy the log files for your application's Amazon EC2 instances to the Amazon S3 bucket associated with your application. | string | `false` | no |
8887
| enable_managed_actions | Enable managed platform updates. When you set this to true, you must also specify a `PreferredStartTime` and `UpdateLevel` | string | `true` | no |
8988
| enable_stream_logs | Whether to create groups in CloudWatch Logs for proxy and deployment logs, and stream logs from each instance in your environment. | string | `false` | no |
89+
| enhanced_reporting_enabled | Whether to enable "enhanced" health reporting for this environment. If false, "basic" reporting is used. When you set this to false, you must also set `enable_managed_actions` to false | string | `true` | no |
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 |
@@ -132,7 +132,7 @@ Available targets:
132132
| updating_min_in_service | Minimum count of instances up during update | string | `1` | no |
133133
| version_label | Elastic Beanstalk Application version to deploy | string | `` | no |
134134
| vpc_id | ID of the VPC in which to provision the AWS resources | string | - | yes |
135-
| wait_for_ready_timeout | | string | `20m` | no |
135+
| wait_for_ready_timeout | - | string | `20m` | no |
136136
| zone_id | Route53 parent zone ID. The module will create sub-domain DNS records in the parent zone for the EB environment | string | `` | no |
137137

138138
## Outputs
@@ -241,7 +241,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
241241

242242
## Copyright
243243

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

246246

247247

docs/terraform.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
## Inputs
32

43
| Name | Description | Type | Default | Required |
@@ -24,6 +23,7 @@
2423
| enable_log_publication_control | Copy the log files for your application's Amazon EC2 instances to the Amazon S3 bucket associated with your application. | string | `false` | no |
2524
| enable_managed_actions | Enable managed platform updates. When you set this to true, you must also specify a `PreferredStartTime` and `UpdateLevel` | string | `true` | no |
2625
| enable_stream_logs | Whether to create groups in CloudWatch Logs for proxy and deployment logs, and stream logs from each instance in your environment. | string | `false` | no |
26+
| enhanced_reporting_enabled | Whether to enable "enhanced" health reporting for this environment. If false, "basic" reporting is used. When you set this to false, you must also set `enable_managed_actions` to false | string | `true` | no |
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 |
@@ -69,7 +69,7 @@
6969
| updating_min_in_service | Minimum count of instances up during update | string | `1` | no |
7070
| version_label | Elastic Beanstalk Application version to deploy | string | `` | no |
7171
| vpc_id | ID of the VPC in which to provision the AWS resources | string | - | yes |
72-
| wait_for_ready_timeout | | string | `20m` | no |
72+
| wait_for_ready_timeout | - | string | `20m` | no |
7373
| zone_id | Route53 parent zone ID. The module will create sub-domain DNS records in the parent zone for the EB environment | string | `` | no |
7474

7575
## Outputs

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ resource "aws_iam_role" "service" {
3737
}
3838

3939
resource "aws_iam_role_policy_attachment" "enhanced-health" {
40+
count = "${var.enhanced_reporting_enabled ? 1 : 0}"
4041
role = "${aws_iam_role.service.name}"
4142
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth"
4243
}
@@ -670,7 +671,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
670671
setting {
671672
namespace = "aws:elasticbeanstalk:healthreporting:system"
672673
name = "SystemType"
673-
value = "enhanced"
674+
value = "${var.enhanced_reporting_enabled ? "enhanced" : "basic"}"
674675
}
675676
setting {
676677
namespace = "aws:elasticbeanstalk:command"

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ variable "config_document" {
3535
description = "A JSON document describing the environment and instance metrics to publish to CloudWatch."
3636
}
3737

38+
variable "enhanced_reporting_enabled" {
39+
default = true
40+
description = "Whether to enable \"enhanced\" health reporting for this environment. If false, \"basic\" reporting is used. When you set this to false, you must also set `enable_managed_actions` to false"
41+
}
42+
3843
variable "health_streaming_enabled" {
3944
default = false
4045
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."

0 commit comments

Comments
 (0)