Resource: awsAthenaDatabase
Provides an Athena database.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsS3BucketExample = new aws.s3Bucket.S3Bucket(this, "example", {
bucket: "example",
});
const awsAthenaDatabaseExample = new aws.athenaDatabase.AthenaDatabase(
this,
"example_1",
{
bucket: awsS3BucketExample.id,
name: "database_name",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsAthenaDatabaseExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
bucket
- (Required) Name of S3 bucket to save the results of the query execution.name
- (Required) Name of the database to create.aclConfiguration
- (Optional) That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.comment
- (Optional) Description of the database.encryptionConfiguration
- (Optional) Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.expectedBucketOwner
- (Optional) AWS account ID that you expect to be the owner of the Amazon S3 bucket.forceDestroy
- (Optional, Default: false) Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.properties
- (Optional) Key-value map of custom metadata properties for the database definition.
ACL Configuration
s3AclOption
- (Required) Amazon S3 canned ACL that Athena should specify when storing query results. Valid value isBUCKET_OWNER_FULL_CONTROL
.
\~> NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using forceDestroy
on the bucket too in order to avoid any problems when destroying the bucket.
Encryption Configuration
encryptionOption
- (Required) Type of key; one ofSSE_S3
,SSE_KMS
,CSE_KMS
kmsKey
- (Optional) KMS key ARN or ID; required for key typesSSE_KMS
andCSE_KMS
.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- Database name
Import
Athena Databases can be imported using their name, e.g.,
Certain resource arguments, like encryptionConfiguration
and bucket
, do not have an API method for reading the information after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use ignoreChanges
to hide the difference, e.g.,
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsAthenaDatabaseExample = new aws.athenaDatabase.AthenaDatabase(
this,
"example",
{
bucket: "${aws_s3_bucket.example.id}",
name: "database_name",
}
);
awsAthenaDatabaseExample.addOverride("lifecycle", [
{
ignore_changes: ["${bucket}"],
},
]);