-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Passing multiline filter values as strings is not working with escape and heredoc #6801
Comments
@crisalid your log does not contain the ERROR section. But from your plan, I am able to mimic and create the
|
@edwardmedia thanks for your reply! Error: googleapi: Error 400: Resource id contains illegal character, badRequest on main.tf line 40, in resource "google_logging_organization_sink" "static_filters": it's generated by the code above. |
@crisalid can you post your code showing how you assign the filter values through variables? |
variable "events" {
#type = "map"
default = {
"Admin permissions" = "(protoPayload.methodName=\"google.admin.AdminService.assignRole\" OR protoPayload.methodName=\"google.admin.AdminService.addPrivilege\")"
}
}
resource "google_logging_organization_sink" "static_filters" {
org_id = var.org_id
destination = "pubsub.googleapis.com/projects/${var.project}/topics/${google_pubsub_topic.high_priority_events_topic.name}"
include_children = true
for_each = var.events
name = each.key
filter = each.value
} |
@crisalid by using for_each, do you expect it can create multiple sinks? I don't think it supports that |
ok, I removed for_each. |
@crisalid can you post your updated code which yields |
@edwardmedia I think this might be related to the backslash symbol not being url encoded for being used with google rest api |
@crisalid I was using below filter in the code and apply was complete successfully. Could you be more specific about the backslash symbol which causes problem? Please share your code so I can repro the problem. Thanks |
my fault. |
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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
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.28
Affected Resource(s)
"google_logging_organization_sink"
Terraform Configuration Files
Debug Output
https://gist.github.com/crisalid/79f766a34ea1f992966b31a18ea9ef2f
Panic Output
Error: googleapi: Error 400: Resource id contains illegal character, badRequest
on main.tf line 40, in resource "google_logging_organization_sink" "static_filters":
40: resource "google_logging_organization_sink" "static_filters" {
Expected Behavior
escaped double-quote symbols inside filter strings should not produce an error.
Actual Behavior
the resource did not get created
Steps to Reproduce
terraform apply
Important Factoids
I have 20 filters to be created. To make a perfectly readable code it would be best to put those filter values as string variables. However, some of them contain multiple double quote character "
This caused me to try like 4 or 5 different ways to work around this issue, as you know - a double quote is used to describe s single string variable in TF. But when there are several " in a line - TF goes crazy :)
so I tried using \ and \\ as escape characters
tried heredoc format
tried putting those strings to text files and a function to read from them
none of that worked
TF argues on illegal characters :)
The text was updated successfully, but these errors were encountered: