Open mdawar opened 8 months ago
Voting for Prioritization
Volunteering to Work on This Issue
This looks quite similar to #35526. Can you take a look at the suggestion here and let us know if that helps at all?
Also of note, in case that doesn't fix it, located this comment on another potentially related issue #30286.
@justinretzolk I've checked that issue, and no I don't think it's related, that issue is about icmpv6
as the protocol
value, this issue is about handling the -1
value being equivalent to all
just like it's handled for aws_vpc_security_group_ingress_rule
and aws_vpc_security_group_egress_rule
.
As you can see in the ProtocolForValue
function.
func ProtocolForValue(v string) string {
// special case -1
protocol := strings.ToLower(v)
if protocol == "-1" || protocol == "all" {
return "-1"
}
// ...
}
Currently a replacement is forced because of this difference, if you just keep applying the config it will keep replacing the resource.
Terraform Core Version
v1.7.4
AWS Provider Version
v5.39.1
Affected Resource(s)
aws_lightsail_instance_public_ports
Expected Behavior
Running
terraform apply
should not force replacement of this resource.Actual Behavior
Replacement of this resource is triggered because of the difference between the
port_info.protocol
value ofall
and-1
as stored in the state.Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
terraform apply
.terraform apply
again.The second apply will try to replace this resource because of the
port_info.protocol
value ofall
.Debug Output
No response
Panic Output
No response
Important Factoids
This value of
-1
is handled foraws_vpc_security_group_ingress_rule
andaws_vpc_security_group_egress_rule
resources, seeProtocolForValue
function, also the value-1
is accepted as a value for theip_protocol
argument of these resources.References
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lightsail_instance_public_ports#protocol https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_security_group_ingress_rule#ip_protocol https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_security_group_egress_rule#ip_protocol
Would you like to implement a fix?
None