https://pulumi.com logo
Title
a

acoustic-room-2113

03/04/2021, 11:16 PM
I'm trying to import some route table associations from existing infra and getting the following error.
pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation platform-public-0.prod subnet-0123/rtb-4567
Previewing import (network.prod):
     Type                              Name                    Plan       Info
     pulumi:pulumi:Stack               network-network.prod               1 error
 =   └─ aws:ec2:RouteTableAssociation  platform-public-0.prod  import     3 errors

Diagnostics:
  pulumi:pulumi:Stack (network-network.prod):
    error: preview failed

  aws:ec2:RouteTableAssociation (platform-public-0.prod):
    error: aws:ec2/routeTableAssociation:RouteTableAssociation resource 'platform-public-0.prod' has a problem: ExactlyOne: "subnet_id": one of `gateway_id,subnet_id` must be specified
    error: aws:ec2/routeTableAssociation:RouteTableAssociation resource 'platform-public-0.prod' has a problem: ExactlyOne: "gateway_id": one of `gateway_id,subnet_id` must be specified
    error: Preview failed: one or more inputs failed to validate
l

little-cartoon-10569

03/04/2021, 11:18 PM
Do you have more than one of gateway and subnet specified?
a

acoustic-room-2113

03/04/2021, 11:55 PM
Negative
All I did was change the identifying parts of the subnet and rtb id's to protect the innocent
l

little-cartoon-10569

03/05/2021, 12:22 AM
It should be fairly easy to track the problem down, there's a lot of info in that error message. How are you creating your RouteTableAssociation objects? Has the code for platform-public-0.prod been created using
pulumi import
?
I'm guessing that it has been created with both a gatewayId and a submetId, one of which has an empty value instead of undefined (or omitted). Removing the offending property should resolve the problem.