Hi,all!
Trying to understand strange behavior of aws_vpc_endpoint constantly asking for replacing because vpc_id change which is not the case.
i am creating an endpoint like this :
resource “aws_vpc_endpoint” “transfer_vpc_endpoint” {
vpc_id = data.aws_vpc.ingress_vpc.id
service_name = “com.amazonaws.region.transfer.server”
vpc_endpoint_type = “Interface”
security_group_ids = [
aws_security_group.transfer_vpc_endpoint_sg.id
]
subnet_ids = data.aws_subnets.ingressinfra_subnets.ids
tags = {
Name = “aws-env-short_region-vpc_id-z-vpce-shrdsvcs-sftp-z”
}
}
and very often when i execute the code is it saying
module.transfer_family.aws_vpc_endpoint.transfer_vpc_endpoint must be replaced
~ vpc_id = “vpc-0a3cc268ae5f122dc” # forces replacement → (known after apply) # forces replacement
issues is because for vpc_id we are using data resource but what we can do to overcome it?
data “aws_vpc” “ingress_vpc” {
filter {
name = “tag:Name”
values = [“aws-env-short_region-z-z-vpc-shrdsvcs-ingress-z”]
}
}
Thanks in advance,
Vladimir