Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to override log configuration options #83

Closed

Conversation

k1rd3rf
Copy link
Contributor

@k1rd3rf k1rd3rf commented Feb 27, 2023

This resolves #76

@k1rd3rf k1rd3rf requested a review from a team as a code owner February 27, 2023 13:25
variable "log_configuration_options_overrides" {
description = "Overrides for log configuration options"
default = {}
type = any
Copy link

@tenstad tenstad Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type = any
type = map

Not quite sure how terraform whould handle maps vs objects 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least when declaring a i.e. object({key1: string, key2: number}), it will only pass on the declared ones, so if I sent in var_name = { keyNotDeclared = "someValue" } it wouldn't be included where it was used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it might work with map. I will take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to specify everything inside map({ ... }) :/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a defined number of options available for the hard coded awslogs driver in the module. These are documented here:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html#create_awslogs_logdriver_options

We are currently setting the awslogs-group, awslogs-region and awslogs-stream-prefix options.

And, as you can see, we have already provided a way to override the awslogs-group option. Maybe you can use the same method to override awslogs-region and awslogs-stream-prefix instead?

Can you provide an example of why you need this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a look at your other #81 PR, and I think these two PRs should be handled together. Since, if you override the log driver, then the default options listed above are wrong.

Fargate supports three different log drivers: awslogs, splunk, and awsfirelens. If we want to support those, then I think we need a conditional for adding the awslogs options that we add by default.

Also, I think we don't want to merge() these other options in with the awslogs options, but rather replace the content of the options key og the logConfiguration altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with everything you write. It is way more than I initially needed, so lets just close this PR and also #81.

@k1rd3rf k1rd3rf closed this Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add Log Configurations
3 participants