no-eip-vpc-attribute
Flag the vpc argument on a resource "aws_eip" block. The AWS provider removed vpc in v6.0.0, so it now fails tofu validate and tofu plan on every 6.x provider. Use domain = "vpc" instead, or omit domain and let it default.
Why
The vpc argument on aws_eip was deprecated (terraform-provider-aws #26714) in favor of domain, then removed from the schema in v6.0.0 (#26715). Any config that still sets vpc errors out on validate and plan once the provider is on 6.x. See the AWS provider v6 upgrade guide and the aws_eip resource docs.
vpc = true selected the VPC domain, which is domain = "vpc". vpc = false selected the EC2-Classic standard domain. EC2-Classic is retired, so deleting vpc = false lets domain default to the computed "vpc". That is an intended semantic change: there is no non-VPC domain to fall back to anymore.
What it flags
A vpc argument inside a resource "aws_eip" block:
resource "aws_eip" "nat" {
vpc = true # removed in provider v6, flagged
}What it does not flag
data "aws_eip"blocks. Only theresourceform is checked.aws_eipblocks that already usedomain:
resource "aws_eip" "nat" {
domain = "vpc"
}Autofix
Partially fixable.
vpc = truebecomesdomain = "vpc".vpc = falseremoves the attribute, lettingdomaindefault to"vpc".
The following are reported without a fix:
- A non-literal value such as
vpc = var.in_vpcorvpc = local.enabled ? true : false, whose boolean value cannot be proven at lint time. - A block that already declares
domain, where renamingvpc = truewould emit a duplicatedomainargument (invalid HCL). - A
vpcargument that shares its line with a trailing comment, to avoid consuming or de-indenting the comment.
Options
None.