-
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
Firewall source_ranges defaults to 0.0.0.0/0 when source_tags not provided (dangerous!) #6789
Comments
Can you please share the plan output of your config ? |
I can easily reproduce the problem when I use tfvars: main.tf provider "google" {
version = "~> 3.14"
region = "europe-west1"
project = "redacted"
}
variable "authorized_ip" {
type = list
default = [""]
}
resource "google_compute_firewall" "powned-fw-rule" {
name = "you-have-been-powned"
network = "default"
source_ranges = var.authorized_ip
allow {
protocol = "udp"
ports = ["666"]
}
} test.tfvars
Execution
As you can see, the 0.0.0.0/0 source range have been set and I think we cannot be implicit on that rule. This is a dangerous behaviour. |
Recently got stung by this. Big security issue this, especially the fact it's undocumented. In fact the documentation is wrong:
This should really be fixed - It should at least require one of the acceptable values as described to make the user specify a range. At a minimum the default behaviour of |
…pe (beta) (hashicorp#6789) * feat: add the iam resources for featurestore entitytype * fix: fix the unit test errors Signed-off-by: Modular Magician <magic-modules@google.com>
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)
Terraform Configuration Files
Expected Behavior
As neither
source_tags
norsource_ranges
were provided, Terraform should report an error when applying. This would match the behavior of the Google Cloud Console UI which requires at least one of these to be defined to create a firewall rule.Actual Behavior
Terraform happily applies the rule and sets the
source_ranges
to0.0.0.0/0
- giving the whole internet access to the resourceSteps to Reproduce
terraform apply
Important Factoids
The goal here is to reduce repeatitive code by defining firewall rules in a map and using for_each. As is stands, with this issue we need to define 2 - 3 maps. One map for
source_ranges
based rules, one forsource_tags
based rules and potentially another for rules that specify both.Please also note I've tried using
[]
in place of thenull
value and the behavior is the same.References
The following issues seems similar/related
b/304967966
The text was updated successfully, but these errors were encountered: