-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
resource/aws_lb: Disable access_logs for network load balancers #2256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gmccue
This seems rather good!
Just left a question to discuss before I test & merge.
Thanks for the work! 👍
CHANGELOG.md
Outdated
@@ -35,6 +35,7 @@ BUG FIXES: | |||
* resource/aws_cloudwatch_log_group: Use ID as name [GH-2190] | |||
* resource/aws_elasticsearch_domain: Added ForceNew to vpc_options [GH-2157] | |||
* resource/aws_redshift_cluster: Make snapshot identifiers `ForceNew` [GH-2212] | |||
* resource/aws_lb: Disable access logs for network load balancers [GH-2145] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed as it is made post-merge :)
aws/resource_aws_lb.go
Outdated
@@ -316,7 +316,8 @@ func resourceAwsLbUpdate(d *schema.ResourceData, meta interface{}) error { | |||
|
|||
attributes := make([]*elbv2.LoadBalancerAttribute, 0) | |||
|
|||
if d.HasChange("access_logs") { | |||
// Access Logs are not supported for Network Loadbalancers | |||
if d.Get("load_balancer_type").(string) != "network" && d.HasChange("access_logs") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not feeling comfortable in allowing a terraform apply
when the code will just ignore it. I do think we should add a guard when planning/applying, saying that this is not allowed rather than ignoring it, which may people think that logs are configured whereas it is not.
Thoughts? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree, but preventing apply
entirely might cause some issues as well. For my use case, see: https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf#L15. In certain modules it wouldn't be possible to create network
load balancers this way.
But I'm a bit of a TF noob. Is there a way to do a check within the module?
Otherwise we could check against the access_logs.enabled
parameter.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also add a log.Printf("[WARN]")
, but I'm not sure what the preferred method is for handling these cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ninir Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go for an INFO notice here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ninir Done!
enable_deletion_protection = false | ||
|
||
access_logs { | ||
bucket = "${aws_s3_bucket.logs.bucket}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line and the one after will trigger issues:
- no such
var.bucket_prefix
variable - no such logs bucket
Could you have a look? otherwise looks good to me!
@Ninir I'm a bit stuck here. The problem is that the new acceptance test to check that access logs are disabled fails:
As far as I can tell, this is because the test setup does a |
@Ninir any thoughts? |
@Ninir @radeksimko Sorry to bother again with this, but do you have any more guidance or input for this PR? Or should I just close it? |
@bflad @radeksimko is this still relevant, or should I go ahead and close this PR? |
Hi @gmccue! 👋 Sorry that we've been slow to re-review this PR. I can't speak for the other maintainers (and would prefer they continued their review unless they don't have time) but it might be beneficial to migrate some of the logic into the Admittedly, the handling of ALB vs NLB in these resources has proven to be quite onerous and generated a ton of issues. To better remedy the situation, we have talked internally about potentially splitting the resources into |
* upstream/master: (1043 commits) Fix ordering for #3537 Update CHANGELOG for #3537 duplicate preferred_backup_window attribute Update CHANGELOG for #3597 Create validateRFC3339TimeString ValidateFunc instead of inline resource/aws_ssm_activation: Prevent crash with expiration_date Update directory_service_directory.html.markdown More consistent use of LB vs ALB. Add test with progressive update of NLB Update CHANGELOG.md New Resource: aws_iot_thing deps: Bump [email protected] Update CHANGELOG for #3513 docs/resource/directory_service_directory: Additional examples Adds env check so that acceptance tests pass Fix typo Fix dumb dumb errors Add a positive test Add doc for cross-zone load balancing resource/aws_lb: Add Cross Zone Load Balancing support ...
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fixes #2145