Resource: awsAthenaNamedQuery
Provides an Athena Named Query resource.
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 awsKmsKeyTest = new aws.kmsKey.KmsKey(this, "test", {
deletionWindowInDays: 7,
description: "Athena KMS Key",
});
const awsS3BucketHoge = new aws.s3Bucket.S3Bucket(this, "hoge", {
bucket: "tf-test",
});
const awsAthenaDatabaseHoge = new aws.athenaDatabase.AthenaDatabase(
this,
"hoge_2",
{
bucket: awsS3BucketHoge.id,
name: "users",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsAthenaDatabaseHoge.overrideLogicalId("hoge");
const awsAthenaWorkgroupTest = new aws.athenaWorkgroup.AthenaWorkgroup(
this,
"test_3",
{
configuration: {
resultConfiguration: {
encryptionConfiguration: {
encryptionOption: "SSE_KMS",
kmsKeyArn: awsKmsKeyTest.arn,
},
},
},
name: "example",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsAthenaWorkgroupTest.overrideLogicalId("test");
new aws.athenaNamedQuery.AthenaNamedQuery(this, "foo", {
database: awsAthenaDatabaseHoge.name,
name: "bar",
query: `SELECT * FROM \${${awsAthenaDatabaseHoge.name}} limit 10;`,
workgroup: awsAthenaWorkgroupTest.id,
});
Argument Reference
The following arguments are supported:
name
- (Required) Plain language name for the query. Maximum length of 128.workgroup
- (Optional) Workgroup to which the query belongs. Defaults toprimary
database
- (Required) Database to which the query belongs.query
- (Required) Text of the query itself. In other words, all query statements. Maximum length of 262144.description
- (Optional) Brief explanation of the query. Maximum length of 1024.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- Unique ID of the query.
Import
Athena Named Query can be imported using the query ID, e.g.,