pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

`error: internal error: Error: Missing newline after argument` on import of RouteTableAssociation with parent

Open Makeshift opened this issue 1 year ago • 2 comments

What happened?

When attempting to import a aws:ec2/subnet:Subnet with a child aws:ec2/routeTableAssociation:RouteTableAssociation, Pulumi errors with:

error: internal error: Error: Missing newline after argument

  on anonymous.pp line 21:
  22: parent = 1c-tgw-connectivity

An argument definition must end with a newline.

This doesn't appear to actually fail the import - the resources still go into state, but Pulumi doesn't get far enough to generate the code describing the resources.

Example

  • Create an empty Pulumi project
  • pulumi stack init prod
  • Given the following import.json:
{
  "resources": [
    {
      "id": "subnet-006e382738c58236d",
      "type": "aws:ec2/subnet:Subnet",
      "name": "1c-tgw-connectivity"
    },
    {
      "id": "subnet-006e382738c58236d/rtb-015e74b5ae5e1704b",
      "type": "aws:ec2/routeTableAssociation:RouteTableAssociation",
      "name": "1c-tgw-rtb-assoc",
      "parent": "1c-tgw-connectivity"
    }
  ]
}
  • pulumi import --file ./import.json -y

Output of pulumi about

CLI
Version      3.116.1
Go Version   go1.22.2
Go Compiler  gc

Plugins
KIND      NAME    VERSION
language  nodejs  unknown

Host
OS       ubuntu
Version  23.04
Arch     x86_64

This project is written in nodejs: executable='/home/connor/.nvm/versions/node/v20.13.1/bin/node' version='v20.13.1'

Backend
Name           einstein
URL            file:///home/connor/echobox/repos/infrastructure/stacks/original-main-account/main-vpc/.localstate/
User           connor
Organizations
Token type     personal

Pulumi locates its logs in /tmp by default
warning: Failed to get information about the Pulumi program's dependencies: could not find either /home/connor/echobox/repos/infrastructure/stacks/original-main-account/main-vpc/yarn.lock or /home/connor/echobox/repos/infrastructure/stacks/original-main-account/main-vpc/package-lock.json
warning: Failed to get information about the current stack: No current stack

Additional context

Here is the debug log of the above reproduction as output by

TF_LOG=TRACE pulumi import --logtostderr --logflow -v=10 --file ./import-broke.json 2> debug.txt

debug.txt

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Makeshift avatar May 20 '24 19:05 Makeshift

I'm sorry this does not work as expected! Would it be possible to add a quick Pulumi program that provisions a "aws:ec2/subnet:Subnet" with a child "aws:ec2/routeTableAssociation:RouteTableAssociation" that would then be used to import from another program? This could help accelerate diagnosing and fixing the issue. Thank you!

Also an output of pulumi about is appreciated as it states all the versions used in the stack.

t0yv0 avatar May 20 '24 20:05 t0yv0

I'm sorry this does not work as expected! Would it be possible to add a quick Pulumi program that provisions a "aws:ec2/subnet:Subnet" with a child "aws:ec2/routeTableAssociation:RouteTableAssociation" that would then be used to import from another program? This could help accelerate diagnosing and fixing the issue. Thank you!

Hm, I tried to create a reproduction repo but I don't seem to be able to replicate it outside of my environment. I'll give it another shot tomorrow - getting pretty late here!

Also an output of pulumi about is appreciated as it states all the versions used in the stack.

I did attach the output of pulumi about, though it seemed that it failed to find some of the information (see the errors at the bottom), possibly because the program I initially found this issue with is within a yarn workspace?

Makeshift avatar May 20 '24 22:05 Makeshift