Hello everyone, How can I validate so that it does...
# aws
e
Hello everyone, How can I validate so that it does not create the table when it already exists? My problem is:
Copy code
error: update failed

 

  aws:dynamodb:Table (test-db-dev):

    error: 1 error occurred:
c
Was this created outside of pulumi? if so you would need to import the state
e
I am creating the table with pulumi
Copy code
const attributes = [
  {
    name: "id",
    type: "S",
  },
  {
    name: "testId",
    type: "S",
  },
];
export const basicDynamodbTable: aws.dynamodb.Table = new aws.dynamodb.Table(
  "test-db-dev",
  {
    attributes,
    name: "test-db-dev",
    billingMode: "PROVISIONED",
    hashKey: "id",
    globalSecondaryIndexes: [
      {
        hashKey: "testId",
        name: "testId-index",
        projectionType: "ALL",
        readCapacity: 20,
        writeCapacity: 20,
      },
    ],

    readCapacity: 20,
    writeCapacity: 20,
  },
);
l
Then you don't need to validate that it already exists. That's Pulumi's job.
1
🙌 1
Pulumi is not imperative: the Pulumi code you write does not mean "create table with this config". It's declarative: the Pulumi code you write means "ensure this table exists and is configured this way".
1
🙌 1