How to create a data source using Terraform

Hi, I am trying to automate the creation of a data-source using Terraform. The documentation does not provide a lot details. I have manually created the vpc-connection and providing the arn.

> resource "aws_quicksight_data_source" "rdspg" {
>     data_source_id = "example_id"
>     name = "This is just to Test Terraform deployments"
>     vpc_connection_properties { vpc_connection_arn =  "arn:aws:quicksight:us-east-1:123456789012:vpcConnection/test-01" }
>     parameters {
>         rds {
>          
>   }
>        
> }
>  type = "POSTGRESQL"
> }

Appreciate any help !

Did you pass in datasourceparameters?

I tried but could not find the right syntax -

parameters {
        rds {
             DataSourceParameters {
                database = "abc"
                instance_id = "abc"

             }
             credential_pair {
                 username = "postgres"
                 password = "aaaaa"
             }
       
     }
Finally, I am able to create now using the following --
> 
> resource "aws_quicksight_data_source" "rdspg" {
>     data_source_id = "example_id"
>     name = "1234"
>     vpc_connection_properties { vpc_connection_arn =  "arn:aws:quicksight:us-east-1:123456789012:vpcConnection/test-01" }
>     parameters {
>            rds {
>                 database = "testing"
>                 instance_id = "dadada"
>              }
>              }
>     credentials {
>           credential_pair {
>                  username = "postgres"
>                  password = "1234"
>             }
>     }         
> type = "POSTGRESQL"
> }
1 Like