Use SQL to instantly query AWS resources across regions and accounts. Open source CLI. No DB required.
191
stars
103
forks
source link
Add table aws_timestreamwrite_database and aws_timestreamwrite_table Closes #2263 #2262 #2269
Closed
ParthaI closed 3 months ago
Integration test logs
Logs
``` No env file present for the current environment: staging Falling back to .env config No env file present for the current environment: staging customEnv TURBOT_TEST_EXPECTED_TIMEOUT undefined SETUP: tests/aws_timestreamwrite_table [] PRETEST: tests/aws_timestreamwrite_table TEST: tests/aws_timestreamwrite_table Running terraform data.aws_partition.current: Reading... data.aws_caller_identity.current: Reading... data.aws_region.primary: Reading... data.aws_partition.current: Read complete after 0s [id=aws] data.aws_region.primary: Read complete after 0s [id=us-east-1] data.aws_caller_identity.current: Read complete after 0s [id=xxxxxxxxxxxx] data.null_data_source.resource: Reading... data.null_data_source.resource: Read complete after 0s [id=static] data.aws_region.alternate: Reading... data.aws_region.alternate: Read complete after 0s [id=us-east-2] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # aws_kms_key.named_test_resource will be created + resource "aws_kms_key" "named_test_resource" { + arn = (known after apply) + bypass_policy_lockout_safety_check = false + customer_master_key_spec = "SYMMETRIC_DEFAULT" + deletion_window_in_days = 20 + description = "An example symmetric encryption KMS key" + enable_key_rotation = true + id = (known after apply) + is_enabled = true + key_id = (known after apply) + key_usage = "ENCRYPT_DECRYPT" + multi_region = (known after apply) + policy = (known after apply) + rotation_period_in_days = (known after apply) + tags_all = (known after apply) } # aws_kms_key_policy.named_test_resource will be created + resource "aws_kms_key_policy" "named_test_resource" { + bypass_policy_lockout_safety_check = false + id = (known after apply) + key_id = (known after apply) + policy = jsonencode( { + Id = "key-default-1" + Statement = [ + { + Action = "kms:*" + Effect = "Allow" + Principal = { + AWS = "arn:aws:iam::xxxxxxxxxxxx:root" } + Resource = "*" + Sid = "Enable IAM User Permissions" }, ] + Version = "2012-10-17" } ) } # aws_timestreamwrite_database.named_test_resource will be created + resource "aws_timestreamwrite_database" "named_test_resource" { + arn = (known after apply) + database_name = "turbottest23473" + id = (known after apply) + kms_key_id = (known after apply) + table_count = (known after apply) + tags = { + "Name" = "turbottest23473" } + tags_all = { + "Name" = "turbottest23473" } } # aws_timestreamwrite_table.named_test_resource will be created + resource "aws_timestreamwrite_table" "named_test_resource" { + arn = (known after apply) + database_name = "turbottest23473" + id = (known after apply) + table_name = "turbottest23473" + tags = { + "Name" = "turbottest23473" } + tags_all = { + "Name" = "turbottest23473" } + retention_properties { + magnetic_store_retention_period_in_days = 30 + memory_store_retention_period_in_hours = 8 } } Plan: 4 to add, 0 to change, 0 to destroy. Changes to Outputs: + account_id = "xxxxxxxxxxxx" + aws_partition = "aws" + region_name = "us-east-1" + resource_aka = (known after apply) + resource_name = "turbottest23473" aws_kms_key.named_test_resource: Creating... aws_kms_key.named_test_resource: Creation complete after 8s [id=e0014783-a3d5-4702-9fd7-8c856a6bce47] aws_kms_key_policy.named_test_resource: Creating... aws_timestreamwrite_database.named_test_resource: Creating... aws_timestreamwrite_database.named_test_resource: Creation complete after 3s [id=turbottest23473] aws_timestreamwrite_table.named_test_resource: Creating... aws_timestreamwrite_table.named_test_resource: Creation complete after 1s [id=turbottest23473:turbottest23473] aws_kms_key_policy.named_test_resource: Creation complete after 6s [id=e0014783-a3d5-4702-9fd7-8c856a6bce47] Warning: Deprecated with data.null_data_source.resource, on variables.tf line 44, in data "null_data_source" "resource": 44: data "null_data_source" "resource" { The null_data_source was historically used to construct intermediate values to re-use elsewhere in configuration, the same can now be achieved using locals or the terraform_data resource type in Terraform 1.4 and later. (and one more similar warning elsewhere) Apply complete! Resources: 4 added, 0 changed, 0 destroyed. Outputs: account_id = "xxxxxxxxxxxx" aws_partition = "aws" region_name = "us-east-1" resource_aka = "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest23473/table/turbottest23473" resource_name = "turbottest23473" Running SQL query: test-get-query.sql Time: 2.5s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0. Scans: 1) aws_timestreamwrite_table.aws: Time: 2.2s. Fetched: 1. Hydrates: 0. Quals: table_name=turbottest23473, database_name=turbottest23473. [ { "arn": "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest23473/table/turbottest23473", "database_name": "turbottest23473", "table_name": "turbottest23473" } ] ✔ PASSED Running SQL query: test-list-call-query.sql Time: 0.7s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0. Scans: 1) aws_timestreamwrite_table.aws: Time: 0.5s. Fetched: 1. Hydrates: 0. [ { "arn": "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest23473/table/turbottest23473", "table_name": "turbottest23473" } ] ✔ PASSED Running SQL query: test-turbot-query.sql Time: 123ms. Rows returned: 1. Rows fetched: 1 (cached). Hydrate calls: 0. Scans: 1) aws_timestreamwrite_table.aws: Time: 15ms. Fetched: 1 (cached). Hydrates: 0. [ { "akas": [ "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest23473/table/turbottest23473" ], "title": "turbottest23473" } ] ✔ PASSED POSTTEST: tests/aws_timestreamwrite_table TEARDOWN: tests/aws_timestreamwrite_table SUMMARY: 1/1 passed. --- No env file present for the current environment: staging Falling back to .env config No env file present for the current environment: staging customEnv TURBOT_TEST_EXPECTED_TIMEOUT undefined SETUP: tests/aws_timestreamwrite_database [] PRETEST: tests/aws_timestreamwrite_database TEST: tests/aws_timestreamwrite_database Running terraform data.aws_caller_identity.current: Reading... data.aws_partition.current: Reading... data.aws_region.primary: Reading... data.aws_region.primary: Read complete after 0s [id=us-east-1] data.aws_partition.current: Read complete after 0s [id=aws] data.aws_region.alternate: Reading... data.aws_region.alternate: Read complete after 0s [id=us-east-2] data.aws_caller_identity.current: Read complete after 0s [id=xxxxxxxxxxxx] data.null_data_source.resource: Reading... data.null_data_source.resource: Read complete after 0s [id=static] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # aws_kms_key.named_test_resource will be created + resource "aws_kms_key" "named_test_resource" { + arn = (known after apply) + bypass_policy_lockout_safety_check = false + customer_master_key_spec = "SYMMETRIC_DEFAULT" + deletion_window_in_days = 20 + description = "An example symmetric encryption KMS key" + enable_key_rotation = true + id = (known after apply) + is_enabled = true + key_id = (known after apply) + key_usage = "ENCRYPT_DECRYPT" + multi_region = (known after apply) + policy = (known after apply) + rotation_period_in_days = (known after apply) + tags_all = (known after apply) } # aws_kms_key_policy.named_test_resource will be created + resource "aws_kms_key_policy" "named_test_resource" { + bypass_policy_lockout_safety_check = false + id = (known after apply) + key_id = (known after apply) + policy = jsonencode( { + Id = "key-default-1" + Statement = [ + { + Action = "kms:*" + Effect = "Allow" + Principal = { + AWS = "arn:aws:iam::xxxxxxxxxxxx:root" } + Resource = "*" + Sid = "Enable IAM User Permissions" }, ] + Version = "2012-10-17" } ) } # aws_timestreamwrite_database.named_test_resource will be created + resource "aws_timestreamwrite_database" "named_test_resource" { + arn = (known after apply) + database_name = "turbottest85196" + id = (known after apply) + kms_key_id = (known after apply) + table_count = (known after apply) + tags = { + "Name" = "turbottest85196" } + tags_all = { + "Name" = "turbottest85196" } } Plan: 3 to add, 0 to change, 0 to destroy. Changes to Outputs: + account_id = "xxxxxxxxxxxx" + aws_partition = "aws" + region_name = "us-east-1" + resource_aka = (known after apply) + resource_name = "turbottest85196" aws_kms_key.named_test_resource: Creating... aws_kms_key.named_test_resource: Creation complete after 8s [id=7967024f-804b-47dd-b551-e881424ae21c] aws_kms_key_policy.named_test_resource: Creating... aws_timestreamwrite_database.named_test_resource: Creating... aws_timestreamwrite_database.named_test_resource: Creation complete after 3s [id=turbottest85196] aws_kms_key_policy.named_test_resource: Creation complete after 6s [id=7967024f-804b-47dd-b551-e881424ae21c] Warning: Deprecated with data.null_data_source.resource, on variables.tf line 44, in data "null_data_source" "resource": 44: data "null_data_source" "resource" { The null_data_source was historically used to construct intermediate values to re-use elsewhere in configuration, the same can now be achieved using locals or the terraform_data resource type in Terraform 1.4 and later. (and one more similar warning elsewhere) Apply complete! Resources: 3 added, 0 changed, 0 destroyed. Outputs: account_id = "xxxxxxxxxxxx" aws_partition = "aws" region_name = "us-east-1" resource_aka = "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest85196" resource_name = "turbottest85196" Running SQL query: test-get-query.sql Time: 11.7s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0. Scans: 1) aws_timestreamwrite_database.aws: Time: 11.5s. Fetched: 1. Hydrates: 0. Quals: database_name=turbottest85196. [ { "arn": "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest85196", "database_name": "turbottest85196" } ] ✔ PASSED Running SQL query: test-list-call-query.sql Time: 1.4s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0. Scans: 1) aws_timestreamwrite_database.aws: Time: 0.5s. Fetched: 1. Hydrates: 0. [ { "arn": "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest85196", "database_name": "turbottest85196" } ] ✔ PASSED Running SQL query: test-turbot-query.sql Time: 102ms. Rows returned: 1. Rows fetched: 1 (cached). Hydrate calls: 0. Scans: 1) aws_timestreamwrite_database.aws: Time: 2ms. Fetched: 1 (cached). Hydrates: 0. [ { "akas": [ "arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest85196" ], "title": "turbottest85196" } ] ✔ PASSED POSTTEST: tests/aws_timestreamwrite_database TEARDOWN: tests/aws_timestreamwrite_database SUMMARY: 1/1 passed. ```Example query results
Results
``` > select * from aws_timestreamwrite_table +-----------------+------------------------------------------------------------------------------------------+--------------+---------------------------+---------------------------+-----------------+------------------------------------> | table_name | arn | table_status | creation_time | last_updated_time | database_name | schema > +-----------------+------------------------------------------------------------------------------------------+--------------+---------------------------+---------------------------+-----------------+------------------------------------> | turbottest82577 | arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest82577/table/turbottest82577 | ACTIVE | 2024-08-16T18:01:03+05:30 | 2024-08-16T18:01:03+05:30 | turbottest82577 | {"CompositePartitionKey":[{"Enforce> +-----------------+------------------------------------------------------------------------------------------+--------------+---------------------------+---------------------------+-----------------+------------------------------------ --- > select * from aws_timestreamwrite_database +-----------------+--------------------------------------------------------------------+---------------------------+---------------------------+-----------------------------------------------------------------------------+-------------> | database_name | arn | creation_time | last_updated_time | kms_key_id | table_count > +-----------------+--------------------------------------------------------------------+---------------------------+---------------------------+-----------------------------------------------------------------------------+-------------> | turbottest85196 | arn:aws:timestream:us-east-1:xxxxxxxxxxxx:database/turbottest85196 | 2024-08-16T18:24:25+05:30 | 2024-08-16T18:24:25+05:30 | arn:aws:kms:us-east-1:xxxxxxxxxxxx:key/7967024f-804b-47dd-b551-e881424ae21c | 0 > +-----------------+--------------------------------------------------------------------+---------------------------+---------------------------+-----------------------------------------------------------------------------+------------- ```