-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Error: log_config cannot be defined when enable_logging is false #7309
Comments
@MrVentzi I can repro the |
I can confirm the issue as well (just saw it in our environment). Using the deprecated field to have the new field work doesn't make sense. |
@iangelov To workaround the issue, when you add |
@edwardmedia Yes I did see that if I have both the |
I don think this is a dup of #7322 I have an other error message and I specify neither log_config or enable_logging |
Hey @MrVentzi, I don't believe we can do anything about this due to provider limitations. When In the provider we can't tell the difference between a false and nil boolean (closed in favor of this issue) nor can we determine what is coming from the config vs what is just leftover from state. Essentially, we don't have a way to differentiate your scenario from someone explicitly trying to set If you've previously set |
Instead of closing, I will set this to |
The way I ran into this was by enabling logging briefly for a firewall rule in the web console. (I have neither |
I experience this similarly: We had added this to some fw-rules: log_config {
metadata = "EXCLUDE_ALL_METADATA"
} And we expected that the removal of this block would just remove/disable logging. The only thing that's currently working for us in the sense of having a) disabled logging and b) no error messages, is to use the deprecated attribute Yes, this is more related to #7322. A different weird workaround would possibly something like lifecycle {
ignore_changes = [log_config]
} But I'd really like to prevent using this. |
We also hit this one :(! Steps to reproduce:
log_config {
metadata = "INCLUDE_ALL_METADATA"
}
The outcome is this error: An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# module.generator.google_compute_firewall.p01vpc01-p01vpc01f2 will be updated in-place
~ resource "google_compute_firewall" "p01vpc01-p01vpc01f2" {
id = "projects/obfuscated/global/firewalls/allow-http-out"
name = "allow-http-out"
~ source_ranges = [
+ "0.0.0.0/0",
- "10.10.10.10/32",
]
# (14 unchanged attributes hidden)
# (1 unchanged block hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
root@f930494b5bba:/local# terragrunt apply plan.out
module.generator.google_compute_firewall.p01vpc01-p01vpc01f2: Modifying... [id=projects/obfuscated/global/firewalls/allow-http-out]
Error: Error updating Firewall "projects/obfuscated/global/firewalls/allow-http-out": googleapi: Error 400: Invalid value for field 'resource.logConfig': '{ "enable": false}'. Logging for this firewall rule must be enabled to toggle logging options., invalid
ERRO[0002] Hit multiple errors:
Hit multiple errors:
exit status 1 NoteDescribing this rule with $ gcloud compute firewall-rules describe deny-incoming
creationTimestamp: '2021-03-19T06:08:35.543-07:00'
denied:
- IPProtocol: all
description: terraform managed
direction: INGRESS
disabled: false
id: 'obfuscated'
kind: compute#firewall
logConfig:
enable: false
name: deny-incoming
network: https://www.googleapis.com/compute/v1/projects/obfuscated/global/networks/vpc1
priority: 1000
selfLink: https://www.googleapis.com/compute/v1/projects/obfuscated/global/firewalls/deny-incoming
sourceRanges:
- 0.0.0.0/0 Unfortunately at the moment there is no way to resolve this issue other than deleting and re-creating the entire rule! |
Ping @ndmckinley can you help out on this one? Once logging was enabled and disabled afterwards it leaves a "corrupt" firewall rule that no longer can be edited with Terraform. |
Any advice on how to achieve this easily? I feel like if upstream aren't fixing this, it should at least blow away the old rule and re-create it with the newly set logging options (be that disabled or enabled). It might be there's something simple I can add to our firewall module to achieve this, but I'm unsure what. |
Still having this issue with provider 4.9.0. Any news about the fix? I put enable_logging in my tf files ... |
Still having this issue with provider 5.25.0 (latest) Any news about the fix? |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Terraform v0.12.18
Affected Resource(s)
Terraform Configuration Files
Originally had this:
Which gave us the deprecation warning:
Warning: "enable_logging": [DEPRECATED] Deprecated in favor of log_config
So we replaced it by this:
Debug Output
Panic Output
Expected Behavior
The resource should've been updated to use the new config.
Actual Behavior
Since some of the environments don't need this extra logging, they have it already set to false from previous config. Changing it gives the following error.
Error: log_config cannot be defined when enable_logging is false
Steps to Reproduce
Important Factoids
References
The text was updated successfully, but these errors were encountered: