Skip to content

Commit 02adf61

Browse files
committed
feat: support comment property for athena databases
1 parent 3b1304d commit 02adf61

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

internal/service/athena/database.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func ResourceDatabase() *schema.Resource {
3333
Required: true,
3434
ForceNew: true,
3535
},
36+
"comment": {
37+
Type: schema.TypeString,
38+
Optional: true,
39+
},
3640
"force_destroy": {
3741
Type: schema.TypeBool,
3842
Optional: true,
@@ -93,8 +97,15 @@ func expandAthenaResultConfiguration(bucket string, encryptionConfigurationList
9397
func resourceDatabaseCreate(d *schema.ResourceData, meta interface{}) error {
9498
conn := meta.(*conns.AWSClient).AthenaConn
9599

100+
var databaseDescription string
101+
if v, ok := d.GetOk("comment"); ok {
102+
databaseDescription = strings.Replace(v.(string), "'", "\\'", -1)
103+
} else {
104+
databaseDescription = ""
105+
}
106+
96107
input := &athena.StartQueryExecutionInput{
97-
QueryString: aws.String(fmt.Sprintf("create database `%s`;", d.Get("name").(string))),
108+
QueryString: aws.String(fmt.Sprintf("create database `%[1]s` comment '%[2]s';", d.Get("name").(string), databaseDescription)),
98109
ResultConfiguration: expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{})),
99110
}
100111

0 commit comments

Comments
 (0)