-
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
aws_security_group_rule: InvalidParameterValue: When protocol is ALL, you cannot specify from-port. #1920
Comments
Edit: I've updated to terraform 0.10.8, and haven't been able to reproduce it, though the problem was somewhat intermittent before. I am seeing this error as well.
As you can see, protocol is clearly "-1", and from_port and to_port are 0. So why is terraform sending a port across the API???? |
I get the same error when I try to update an aws_security_group_rule in eu-west-1. I did not get this error in us-west-2 or us-east-1. Edit: I am using terraform 0.10.8. |
Same here, im in us-east-1 and i'm seeing the following:
Note that terraform is trying to change the description wrongly. This sec group's description is actually empty. |
I did get this error in us-west-2, and like you, an upgrade to 1.2 did not resolve the issue. |
have same issue with terraform 0.10.8 in us-east-1 and provider version 1.3 |
This is on: Terraform v0.11 + provider.aws v1.5.0.
I am seeing this in us-west-2 when trying to apply a change to a rule description:
And removing the from_port fails immediately as TF says it is a required value: |
I encountered this issue when updating rule description. oddly enough when updating TLDR
If I only update the description:
Then I got:
However if I update
it got succeed 🎉
|
…all (#34) * Workaround for bug when updating description of a rule with protocol all Error: "Error updating security group rule description: InvalidParameterValue: When protocol is ALL, you cannot specify from-port." Issue: hashicorp/terraform-provider-aws#1920 * Add known issues to README
The number of bugs seen using TF to manage aws_security_group_rule and aws_security_group is completely ridiculous, this is just one more example. These silly workarounds shouldn't be necessary and even the workarounds only work once or twice without rhyme or reason. This makes management of SG's nearly impossible with Terraform.
|
For what its worth, a large portion of these issues would likely go away if the EC2 API provided stable identifiers for security group rules. As it stands currently, we're dependent on identifying and modifying rules/descriptions using the EC2 data type In this case (without diving into the code) seems we might be passing too much information to |
Does anyone fancy having a crack at a fix for this? I've had a quick scan of the AWS provider code but can't quite find the point where this error is thrown. |
@andydix if you set |
@rifelpet I did that and it spits out a 400 response object with the debug entry of: - I've searched through all the AWS provider source but still can't pinpoint the area that throws back this response. GO isn't a language I've used before so it's possibly me not understanding what to look for. I'm sure it'll be obvious if/when I find it :) |
Given the above debug message, the code calls Given the error, seems like we need to prune out some input parameters based on the protocol (or better normalize them in Terraform beforehand). |
Ran into this today. Pretty significant; US-EAST-1 for me. |
Terraform 0.11.5 Same situation. Had to apply the workaround to make it work. |
Hi, Same issue with:
In order to apply the description I had to use "terraform destroy -target aws_security_group_rule.name" and then apply the config back. |
Can't reproduce..
Hint: I removed the default security group rule manually before... provider "aws" {
max_retries = 3
region = "eu-central-1"
profile = "devops"
}
data "aws_vpc" "default" {
default = true
}
data "aws_security_group" "default" {
vpc_id = "${data.aws_vpc.default.id}"
}
resource "aws_security_group_rule" "test" {
security_group_id = "${data.aws_security_group.default.id}"
type = "egress"
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
description = "all"
} $ terraform apply
data.aws_ami.amzn2_base: Refreshing state...
data.aws_vpc.default: Refreshing state...
data.aws_security_group.default: Refreshing state...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
+ aws_security_group_rule.test
id: <computed>
cidr_blocks.#: "1"
cidr_blocks.0: "0.0.0.0/0"
description: "all"
from_port: "0"
protocol: "-1"
security_group_id: "sg-7e92ac14"
self: "false"
source_security_group_id: <computed>
to_port: "0"
type: "egress"
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
aws_security_group_rule.test: Creating...
cidr_blocks.#: "" => "1"
cidr_blocks.0: "" => "0.0.0.0/0"
description: "" => "all"
from_port: "" => "0"
protocol: "" => "-1"
security_group_id: "" => "sg-7e92ac14"
self: "" => "false"
source_security_group_id: "" => "<computed>"
to_port: "" => "0"
type: "" => "egress"
aws_security_group_rule.test: Creation complete after 2s (ID: sgrule-3315173682)
Apply complete! Resources: 1 added, 0 changed, 0 destroyed. $ terraform apply
data.aws_ami.amzn2_base: Refreshing state...
data.aws_vpc.default: Refreshing state...
data.aws_security_group.default: Refreshing state...
aws_security_group_rule.test: Refreshing state... (ID: sgrule-3315173682)
Apply complete! Resources: 0 added, 0 changed, 0 destroyed. |
@n3ph: the issue occurs on the update step only, not on an initial create. |
I've run into the same issue, on update. I currently just create 3 different rules, one for each protocol. Would love to see this thing fixed. |
Having the same issue: |
Same issue: |
Same issue:
|
Same issue: Terraform v0.11.8
|
Same here: Terraform v0.11.8
|
Same here,but i can successful apply with destroy and then create replacement
|
Bug fix pull request submitted: #6407 |
The fix for this has been merged and will release with version 1.43.1 of the AWS provider, likely in the next hour or so. 👍 |
This has been released in version 1.43.1 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
Same here: Terraform v0.11.10 provider.aws v1.45.0 |
Hi @MisderGAO 👋 Can you please open a new bug report with all the relevant details from the bug report template? This should've been fixed in the update mentioned above but maybe there are other unaccounted for cases. |
Done, here is the link: |
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! |
Hi there,
I found issue when I tried to update description of aws_security_group_rule.
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
Important Factoids
References
The text was updated successfully, but these errors were encountered: