steampipe-plugin-aws icon indicating copy to clipboard operation
steampipe-plugin-aws copied to clipboard

Add pagination support in DescribeImages API for aws_ecr_repository table fixes #1196

Open ParthaI opened this issue 1 year ago • 1 comments

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

PRETEST: tests/aws_ecr_repository

TEST: tests/aws_ecr_repository
Running terraform
data.aws_region.alternate: Reading...
data.aws_region.alternate: Read complete after 0s [id=us-east-2]
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_caller_identity.current: Reading...
data.aws_caller_identity.current: Read complete after 1s [id=632902152528]
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_ecr_repository.named_test_resource will be created
  + resource "aws_ecr_repository" "named_test_resource" {
      + arn                  = (known after apply)
      + id                   = (known after apply)
      + image_tag_mutability = "MUTABLE"
      + name                 = "turbottest66015"
      + registry_id          = (known after apply)
      + repository_url       = (known after apply)
      + tags                 = {
          + "name" = "turbottest66015"
        }
      + tags_all             = {
          + "name" = "turbottest66015"
        }
    }

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

Changes to Outputs:
  + account_id    = "632902152528"
  + aws_partition = "aws"
  + aws_region    = "us-east-1"
  + registry_id   = (known after apply)
  + resource_aka  = (known after apply)
  + resource_id   = (known after apply)
  + resource_name = "turbottest66015"
aws_ecr_repository.named_test_resource: Creating...
aws_ecr_repository.named_test_resource: Creation complete after 3s [id=turbottest66015]

Warning: Deprecated Resource

  with data.null_data_source.resource,
  on variables.tf line 43, in data "null_data_source" "resource":
  43: 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

(and one more similar warning elsewhere)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

account_id = "632902152528"
aws_partition = "aws"
aws_region = "us-east-1"
registry_id = "632902152528"
resource_aka = "arn:aws:ecr:us-east-1:632902152528:repository/turbottest66015"
resource_id = "turbottest66015"
resource_name = "turbottest66015"

Running SQL query: test-get-query.sql
[
  {
    "akas": [
      "arn:aws:ecr:us-east-1:632902152528:repository/turbottest66015"
    ],
    "image_tag_mutability": "MUTABLE",
    "partition": "aws",
    "region": "us-east-1",
    "repository_name": "turbottest66015"
  }
]
✔ PASSED

Running SQL query: test-hydrate-query.sql
[
  {
    "akas": [
      "arn:aws:ecr:us-east-1:632902152528:repository/turbottest66015"
    ],
    "repository_name": "turbottest66015",
    "tags": {
      "name": "turbottest66015"
    },
    "title": "turbottest66015"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "arn": "arn:aws:ecr:us-east-1:632902152528:repository/turbottest66015",
    "image_scanning_configuration": {
      "ScanOnPush": false
    },
    "image_tag_mutability": "MUTABLE",
    "partition": "aws",
    "region": "us-east-1",
    "repository_name": "turbottest66015"
  }
]
✔ PASSED

Running SQL query: test-notfound-query.sql
null
✔ PASSED

Running SQL query: test-turbot-query.sql
[
  {
    "account_id": "632902152528",
    "akas": [
      "arn:aws:ecr:us-east-1:632902152528:repository/turbottest66015"
    ],
    "region": "us-east-1",
    "title": "turbottest66015"
  }
]
✔ PASSED

POSTTEST: tests/aws_ecr_repository

TEARDOWN: tests/aws_ecr_repository

SUMMARY:

1/1 passed.

Example query results

Results
> select count(image_details) from aws_ecr_repository
+-------+
| count |
+-------+
| 114   |
+-------+

> select repository_name, image_details from aws_ecr_repository
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------
| repository_name | image_details                                                                                                                                                 
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------
| test23          | [{"ArtifactMediaType":"application/vnd.docker.container.image.v1+json","ImageDigest":"sha256:2212db307b77b1ef1e8374a30d63b3b165b5a32c8a3263a9a1c12fee54e0510c"
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------

ParthaI avatar Aug 03 '22 23:08 ParthaI

'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[bot] avatar Sep 03 '22 23:09 github-actions[bot]

@ParthaI Instead of adding paging, can you please see the suggestions in https://github.com/turbot/steampipe-plugin-aws/issues/1196#issuecomment-1205558977? We've already added the aws_ecr_image table, so I believe we can move forward with the other changes now that apply to this table and its document.

cbruno10 avatar Sep 06 '22 13:09 cbruno10

'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[bot] avatar Oct 06 '22 23:10 github-actions[bot]