TerraformPilot

DevOps

Fix Terraform Error - Error Creating Transfer Server - ConflictException

Fix ConflictException when creating AWS Transfer Family servers in Terraform. Handle duplicate SFTP servers, endpoint conflicts, and identity provider issues.

LLuca Berton1 min read

Quick Answer

#

An AWS Transfer Family server with conflicting configuration already exists — usually a VPC endpoint conflict or duplicate custom hostname. Import the existing server, delete the orphan, or use a different VPC endpoint.

The Error

#
Error: error creating Transfer Server: ConflictException: 
The VPC endpoint is already associated with a server

What Causes This

#
  • VPC endpoint already used — each VPC endpoint can only be associated with one Transfer server
  • Server created outside Terraform — manually or by another config
  • Partial apply failure — server created in AWS but not recorded in state

How to Fix It

#

Solution 1: Import Existing Server

#
# List Transfer servers
aws transfer list-servers --query 'Servers[*].[ServerId,EndpointType,State]' --output table
 
# Import
terraform import aws_transfer_server.sftp s-1234567890abcdef0

Solution 2: Use a Different or New VPC Endpoint

#
resource "aws_vpc_endpoint" "transfer" {
  vpc_id             = aws_vpc.main.id
  service_name       = "com.amazonaws.${var.region}.transfer.server"
  vpc_endpoint_type  = "Interface"
  subnet_ids         = aws_subnet.private[*].id
  security_group_ids = [aws_security_group.transfer.id]
}
 
resource "aws_transfer_server" "sftp" {
  endpoint_type = "VPC"
 
  endpoint_details {
    vpc_id                 = aws_vpc.main.id
    subnet_ids             = aws_subnet.private[*].id
    security_group_ids     = [aws_security_group.transfer.id]
  }
 
  protocols              = ["SFTP"]
  identity_provider_type = "SERVICE_MANAGED"
}

Solution 3: Delete Orphaned Server

#
# Stop and delete the conflicting server
aws transfer stop-server --server-id s-1234567890abcdef0
aws transfer delete-server --server-id s-1234567890abcdef0
terraform apply

Troubleshooting Checklist

#
  1. ✅ Is there an existing Transfer server using the same VPC endpoint?
  2. ✅ Was the server created manually in AWS Console?
  3. ✅ Did a previous apply fail mid-creation?
  4. ✅ Can you import the existing server instead?
#

Conclusion

#

Transfer Family ConflictException usually means the VPC endpoint is already in use by another server. Import the existing server, create a new endpoint, or delete the orphan. Each VPC endpoint can only serve one Transfer server.

#Terraform#Troubleshooting#DevOps#Error Fix#Infrastructure as Code

Share this article