Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table aws_keyspaces_table Closes #2264 #2271

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Add table aws_keyspaces_table Closes #2264 #2271

wants to merge 12 commits into from

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Aug 19, 2024

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_keyspaces_table []

PRETEST: tests/aws_keyspaces_table

TEST: tests/aws_keyspaces_table
Running terraform
data.aws_partition.current: Reading...
data.aws_caller_identity.current: Reading...
data.aws_region.alternate: 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_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_keyspaces_keyspace.named_test_resource will be created
  + resource "aws_keyspaces_keyspace" "named_test_resource" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + name     = "turbottest68990"
      + tags_all = (known after apply)
    }

  # aws_keyspaces_table.named_test_resource will be created
  + resource "aws_keyspaces_table" "named_test_resource" {
      + arn           = (known after apply)
      + id            = (known after apply)
      + keyspace_name = "turbottest68990"
      + table_name    = "turbottest68990"
      + tags_all      = (known after apply)

      + schema_definition {
          + column {
              + name = "test_id"
              + type = "ascii"
            }
          + partition_key {
              + name = "test_id"
            }
        }
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + resource_aka  = (known after apply)
  + resource_name = "turbottest68990"
aws_keyspaces_keyspace.named_test_resource: Creating...
aws_keyspaces_keyspace.named_test_resource: Creation complete after 3s [id=turbottest68990]
aws_keyspaces_table.named_test_resource: Creating...
aws_keyspaces_table.named_test_resource: Still creating... [10s elapsed]
aws_keyspaces_table.named_test_resource: Still creating... [20s elapsed]
aws_keyspaces_table.named_test_resource: Creation complete after 28s [id=turbottest68990/turbottest68990]

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: 2 added, 0 changed, 0 destroyed.

Outputs:

resource_aka = "arn:aws:cassandra:us-east-1:xxxxxxxxxxxx:/keyspace/turbottest68990/table/turbottest68990"
resource_name = "turbottest68990"

Running SQL query: test-get-call-query.sql

Time: 10.9s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0.

Scans:
  1) aws_keyspaces_table.aws: Time: 10.1s. Fetched: 1. Hydrates: 0. Quals: table_name=turbottest68990, keyspace_name=turbottest68990.

[
  {
    "akas": [
      "arn:aws:cassandra:us-east-1:xxxxxxxxxxxx:/keyspace/turbottest68990/table/turbottest68990"
    ],
    "table_name": "turbottest68990",
    "title": "turbottest68990"
  }
]
✔ PASSED

Running SQL query: test-list-call-query.sql

Time: 1.6s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0.

Scans:
  1) aws_keyspaces_table.aws: Time: 303ms. Fetched: 1. Hydrates: 0. Quals: keyspace_name=turbottest68990.

[
  {
    "akas": [
      "arn:aws:cassandra:us-east-1:xxxxxxxxxxxx:/keyspace/turbottest68990/table/turbottest68990"
    ],
    "keyspace_name": "turbottest68990",
    "table_name": "turbottest68990",
    "title": "turbottest68990"
  }
]
✔ PASSED

Running SQL query: test-turbot-query.sql

Time: 0.7s. Rows returned: 1. Rows fetched: 1 (cached). Hydrate calls: 0.

Scans:
  1) aws_keyspaces_table.aws: Time: 203ms. Fetched: 1 (cached). Hydrates: 0. Quals: keyspace_name=turbottest68990.

[
  {
    "akas": [
      "arn:aws:cassandra:us-east-1:xxxxxxxxxxxx:/keyspace/turbottest68990/table/turbottest68990"
    ],
    "title": "turbottest68990"
  }
]
✔ PASSED

POSTTEST: tests/aws_keyspaces_table

TEARDOWN: tests/aws_keyspaces_table

SUMMARY:

1/1 passed.

Example query results

Results
> select * from aws_keyspaces_table where keyspace_name = 'turbottest53146'
+-----------------+-----------------+------------------------------------------------------------------------------------------+--------+------------+-------------------------------+---------------------------+----------------------+-->
| keyspace_name   | table_name      | arn                                                                                      | status | ttl_status | client_side_timestamps_status | creation_timestamp        | default_time_to_live | c>
+-----------------+-----------------+------------------------------------------------------------------------------------------+--------+------------+-------------------------------+---------------------------+----------------------+-->
| turbottest53146 | turbottest53146 | arn:aws:cassandra:us-east-1:xxxxxxxxxxxx:/keyspace/turbottest53146/table/turbottest53146 | ACTIVE | <null>     | <null>                        | 2024-08-19T09:45:25+05:30 | 0                    |  >
+-----------------+-----------------+------------------------------------------------------------------------------------------+--------+------------+-------------------------------+---------------------------+----------------------+-->

@ParthaI ParthaI requested a review from misraved August 19, 2024 04:34
@ParthaI ParthaI self-assigned this Aug 19, 2024
@ParthaI ParthaI linked an issue Aug 19, 2024 that may be closed by this pull request
@ParthaI ParthaI changed the base branch from remove-duplicate-columns to main August 19, 2024 06:42
Copy link
Contributor

@misraved misraved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ParthaI please take a look at the review comments. Thanks!!

func tableAwsKeyspacesTable(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "aws_keyspaces_table",
Description: "AWS Keyspace Table",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "AWS Keyspace Table",
Description: "AWS Keyspaces Table",

List: &plugin.ListConfig{
Hydrate: listKeyspacesTables,
KeyColumns: plugin.KeyColumnSlice{
{Name: "keyspace_name", Require: plugin.Required},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use the ParentHydrate config over here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can use it. However, we currently don't have a table that provides the keyspace name. We'll need to add a separate table for that first, and then we can proceed.

@misraved
Copy link
Contributor

@ParthaI I think @Priyanka-Chatterjee-2000 would need this table for the Compliance benchmark, wherein passing a keyspace_name might not be possible.

I would suggest adding the Parent table to eliminate the need of the required qual.

Thanks!!

@ParthaI
Copy link
Contributor Author

ParthaI commented Aug 29, 2024

I will add the parent table 👍

Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale No recent activity has been detected on this issue/PR and it will be closed label Oct 28, 2024
@ParthaI ParthaI removed the stale No recent activity has been detected on this issue/PR and it will be closed label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table aws_keyspaces_table
3 participants