diff --git a/internal/service/athena/database.go b/internal/service/athena/database.go index 4827d58866a..9845bd9a265 100644 --- a/internal/service/athena/database.go +++ b/internal/service/athena/database.go @@ -33,6 +33,10 @@ func ResourceDatabase() *schema.Resource { Required: true, ForceNew: true, }, + "comment": { + Type: schema.TypeString, + Optional: true, + }, "force_destroy": { Type: schema.TypeBool, Optional: true, @@ -93,8 +97,15 @@ func expandAthenaResultConfiguration(bucket string, encryptionConfigurationList func resourceDatabaseCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).AthenaConn + var databaseDescription string + if v, ok := d.GetOk("comment"); ok { + databaseDescription = strings.Replace(v.(string), "'", "\\'", -1) + } else { + databaseDescription = "" + } + input := &athena.StartQueryExecutionInput{ - QueryString: aws.String(fmt.Sprintf("create database `%s`;", d.Get("name").(string))), + QueryString: aws.String(fmt.Sprintf("create database `%[1]s` comment '%[2]s';", d.Get("name").(string), databaseDescription)), ResultConfiguration: expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{})), }