Quicksight Dataset via terraform

Hello,

Has anyone used terraform to deploy a Quicksight Dataset.
I am using the this link as a reference. However I get syntax errors, below is the terraform file that I used and the error I get

Error - ‘physicalTableMap’ failed to satisfy constraint: Map keys must satisfy constraint: [Member must have length less than or equal to 64, Member must have length greater than or equal to 1, Member must satisfy regular expression pattern: [0-9a-zA-Z-]*]

  resource "aws_quicksight_data_set" "dataset_resource_name" {
     data_set_id = "dataset_id"
     name = "sample_name"
     import_mode = "SPICE" 
     physical_table_map {
        physical_table_map_id = "physical_table_id"
        custom_sql{
           
            data_source_arn = "arn:aws:quicksight:<<region:account_ID>>:datasource/snowflake-datasource-arn"
            name = "New custom SQL"
            
            sql_query = "select *..... From table.." //This is a huge query
           
            columns  {
                name = "ID"
                type =  "INTEGER"
            }
            
       }

    }
  }

Thanks
Roby

I was able to figure this out. Underscores are not allowed in the physical table map id.
I had to replace
physical_table_id to physical-table-id

1 Like