Skip to content

Commit

Permalink
Add customisable aws log prefix (cloudposse#79)
Browse files Browse the repository at this point in the history
* Add customisable aws log prefix

* Updated README.md

Co-authored-by: actions-bot <[email protected]>
  • Loading branch information
okgolove and actions-bot authored Jan 8, 2021
1 parent 8c5e9fd commit 8799b57
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are
## Usage


**IMPORTANT:** The `master` branch is used in `source` just as an example. In your code, do not pin to `master` because there may be breaking changes between releases.
Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest releases](https://github.com/cloudposse/terraform-aws-ecs-web-app/releases).
**IMPORTANT:** We do not pin modules to versions in our examples because of the
difficulty of keeping the versions in the documentation in sync with the latest released versions.
We highly recommend that in your code you pin the version to the exact version you are
using so that your infrastructure remains stable, and update versions in a
systematic way so that they do not catch you by surprise.

Also, because of a bug in the Terraform registry ([hashicorp/terraform#21417](https://github.com/hashicorp/terraform/issues/21417)),
the registry shows many of our inputs as required when in fact they are optional.
The table below correctly indicates which inputs are required.


For a complete example, see [examples/complete](examples/complete).
Expand Down Expand Up @@ -197,6 +204,7 @@ Available targets:
| autoscaling\_scale\_down\_cooldown | Period (in seconds) to wait between scale down events | `number` | `300` | no |
| autoscaling\_scale\_up\_adjustment | Scaling adjustment to make during scale up event | `number` | `1` | no |
| autoscaling\_scale\_up\_cooldown | Period (in seconds) to wait between scale up events | `number` | `60` | no |
| aws\_logs\_prefix | Custom AWS Logs prefix. If empty name from label module will be used | `string` | `""` | no |
| aws\_logs\_region | The region for the AWS Cloudwatch Logs group | `string` | n/a | yes |
| badge\_enabled | Generates a publicly-accessible URL for the projects build badge. Available as badge\_url attribute when enabled | `bool` | `false` | no |
| branch | Branch of the GitHub repository, e.g. `master` | `string` | `""` | no |
Expand Down Expand Up @@ -469,7 +477,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

## Copyright

Copyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright)
Copyright © 2017-2021 [Cloud Posse, LLC](https://cpco.io/copyright)



Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
| autoscaling\_scale\_down\_cooldown | Period (in seconds) to wait between scale down events | `number` | `300` | no |
| autoscaling\_scale\_up\_adjustment | Scaling adjustment to make during scale up event | `number` | `1` | no |
| autoscaling\_scale\_up\_cooldown | Period (in seconds) to wait between scale up events | `number` | `60` | no |
| aws\_logs\_prefix | Custom AWS Logs prefix. If empty name from label module will be used | `string` | `""` | no |
| aws\_logs\_region | The region for the AWS Cloudwatch Logs group | `string` | n/a | yes |
| badge\_enabled | Generates a publicly-accessible URL for the projects build badge. Available as badge\_url attribute when enabled | `bool` | `false` | no |
| branch | Branch of the GitHub repository, e.g. `master` | `string` | `""` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module "container_definition" {
options = {
"awslogs-region" = var.aws_logs_region
"awslogs-group" = join("", aws_cloudwatch_log_group.app.*.name)
"awslogs-stream-prefix" = module.this.name
"awslogs-stream-prefix" = var.aws_logs_prefix == "" ? module.this.name : var.aws_logs_prefix
}
secretOptions = null
} : null
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ variable "aws_logs_region" {
description = "The region for the AWS Cloudwatch Logs group"
}

variable "aws_logs_prefix" {
type = string
description = "Custom AWS Logs prefix. If empty name from label module will be used"
default = ""
}

variable "log_retention_in_days" {
type = number
description = "The number of days to retain logs for the log group"
Expand Down

0 comments on commit 8799b57

Please sign in to comment.