Open sachinmane1983 opened 1 year ago
@sachinmane1983 can you provide details what you are trying to do? If you have the terraform code, can you share? If you see an issue when you apply a plan, can you share the debug log?
i have created cloud armour edge policy via terraform code now i want apply that policy to load balancer backend bucket so i am attaching policy to resource "google_compute_backend_bucket" "cdn": getting error in resource "google_compute_backend_bucket" "cdn": │ 209: security_policy = var.security_policy_edge │ │ An argument named "security_policy" is not expected here. ╵
`resource "google_compute_security_policy" "policy_edge" {
for_each = var.security_policies_edge
type = "CLOUD_ARMOR_EDGE"
project = var.project_id
name = each.key
dynamic "rule" {
for_each = each.value
content {
action = "allow"
priority = each.value[0]["priority"]
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = each.value[0]["ips"][*].cidr_block
}
}
description = each.value[0]["description"]
}
}
rule {
action = "deny(404)"
priority = "2147483647"
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["*"]
}
}
description = "Deny all by default"
}
}
resource "google_compute_backend_bucket" "cdn" {
name = "bucket-${local.domestic_name_rfc1035safe}"
description = "Backend for serving static content through CDN"
bucket_name = google_storage_bucket.cdn.name
enable_cdn = var.backend_bucket_enable_cdn
security_policy = var.security_policy_edge
dynamic "cdn_policy" {
for_each = var.backend_bucket_enable_cdn ? [1] : []
content {
cache_mode = var.backend_bucket_cache_mode
serve_while_stale = var.backend_bucket_serve_while_stale
default_ttl = var.backend_bucket_cache_default_ttl
max_ttl = var.backend_bucket_cache_max_ttl
client_ttl = var.backend_bucket_cache_client_ttl
}
}
}
variable "security_policy_edge" {
type = string
description = "attach to LB backend bucket"
default = "" # Set a default value or leave it empty if you prefer
}`
b/299338053
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
Affected Resource(s)
gcp load balancer backend bucket
Terraform Configuration Files
Debug Output
Error: Unsupported argument │ │ on terraform-modules/bucket/main.tf line 197, in resource "google_compute_backend_bucket" "cdn": │ 197: security_policy = var.security_policy_edge │ │ An argument named "security_policy" is not expected here.
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
References
0000