Hello I'm importing a dynamodb table created with ...
# sst
u
Hello I'm importing a dynamodb table created with terraform with stream enabled and type to NEW_IMAGE. When I try to import the table and add consumers I have this message : "Please enable the "stream" option to add consumers to the "Table" Is there any workaround or do I have to create the table with sst ?
t
Hm can you try importing the table and deploying without adding the consumers
and see how if it works
u
the import works without adding the consumers
t
So if your import, deploy, then add consumers it doesn't work? Is there a way to turn on stream in the aws ui?
u
nope i tried that
i turned the stream on already with terraform
i expected that when importing the table i would import the config of the streaming and just have to add the consumers in lazy mode
t
This is the code in
addConsumer
that is throwing
Copy code
if (!this.dynamodbTable.tableStreamArn) {
      throw new Error(
        `Please enable the "stream" option to add consumers to the "${this.node.id}" Table.`
      );
    }
u
hmm
t
cc @Frank do we need this check here? Seems like it's empty on imported resources and we don't actually use this field
f
Yeah that makes sense! Just opened an issue https://github.com/serverless-stack/serverless-stack/issues/1036
Will get this in today @Uncharted
u
great 🙂
f
Hey @Uncharted, I dug into this further, so you need to import the table like this:
Copy code
dynamodb.Table.fromTableAttributes(this, "ImportedTable", {
  tableArn: "arn:aws:dynamodb:us-east-1:1234567890:table/myTable",
  tableStreamArn: "arn:aws:dynamodb:us-east-1:1234567890:table/myTable/stream/xxxxxxxxxx",
})
u
hello frank
ok thanks I will do it like that 🙂
f
The
tableStreamArn
has to provided. And you can find it in your AWS DynamoDB console.
u
I thought it would be more intuitive ahah but yes I can use it as a workaround
thanks for your time
f
To add some context, behind the scene, CDK needs to know the stream’s ARN when setting up the consumer.
No worries!