How can I build a DynamoDB Table with Attributes in the go sdk?

I would like to use CDKTF to create a dynamodb table.

The terraform object takes a set of attributes - I can’t see any method or function that would help me do this. I can see that there are some types I can use, but frankly the auto generated documentation is just confusing me further - dynamodb package - - Go Packages

Any advice here?

Hi @martin,

I just did a bit of digging and found an answer:

    // example from
	dynamodb.NewDynamodbTable(stack, jsii.String("basic-dynamodb-table"), &dynamodb.DynamodbTableConfig{
		Name:     jsii.String("GameScore"),
		HashKey:  jsii.String("UserId"),
		RangeKey: jsii.String("GameTitle"),

		Attribute: &[]dynamodb.DynamodbTableAttribute{
			{Name: jsii.String("UserId"), Type: jsii.String("S")},
			{Name: jsii.String("GameTitle"), Type: jsii.String("S")},
			{Name: jsii.String("TopScore"), Type: jsii.String("N")},

		// ...

As the property supports both a reference to such a value (i.e. an IResolvable) and this array of attributes, the tool JSII, which converts our bindings from TypeScript to Go, sets the type to interface{} to allow both of those types to be passed to the config of the resource. To come up with this solution, I had to dig through the underlying TypeScript code to find the right Go representation here.