8000 [FEATURE] readplan · Issue #13 · infraql/infraql · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

[FEATURE] readplan #13

Open
TomKlimovski opened this issue Apr 22, 2021 · 0 comments
Open

[FEATURE] readplan #13

TomKlimovski opened this issue Apr 22, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

8000
@TomKlimovski
Copy link
TomKlimovski commented Apr 22, 2021

Feature Description
Build a command line application in Golang called readplan, which takes one mandatory argument
operation and one optional argument resource

Example(s)
Valid combinations are:
readplan show
readplan select <resource_type>
The show command reads the attached Terraform state file (terraform.tfstate), and returns a
flattened json object with a list of all resources in the state file based upon the type value, for
instance:
[
“aws_s3_bucket_policy”,
“aws_s3_bucket”,
...
]

Possible Approaches or Libraries to Consider
The Select command, for a resource such as readplan select “aws_s3_bucket”
Would return a flattened json response including the name and provider values for the resource
as well as each key and its value from the instances list, for instance:

[
  {
    "name": "ext_stage",
    "provider": "provider.aws",
    "schema_version": 0,
    "attributes": {
      "acceleration_status": "",
      "acl": "private",
      "arn": "arn:aws:s3:::snowpipe-stage",
      "bucket": "snowpipe-stage",
      "bucket_domain_name": "snowpipe-stage.s3.amazonaws.com",

      "bucket_prefix": null,
      "bucket_regional_domain_name": "snowpipe-stage.s3.ap-southeast-2.amazonaws.com",

      "cors_rule": [],
      "force_destroy": false,
      "grant": [],
      "hosted_zone_id": "Z1WCIGYICN2BYD",
      "id": "snowpipe-stage",
      "lifecycle_rule": [],
      "logging": [],
      "object_lock_configuration": [],
      "policy": null,
      "region": "ap-southeast-2",
      "replication_configuration": [],
      "request_payer": "BucketOwner",

      "server_side_encryption_configuration": [
        {
          "rule": [
            {
              "apply_server_side_encryption_by_default": [
                {
                  "kms_master_key_id": "arn:aws:kms:ap-southeast-2:692401932224:alias/snowflake_stage",

                  "sse_algorithm": "aws:kms"
                }
              ]
            }
          ]
        }
      ],
      "tags": {
        "DateModified": "2020-03-15T21:20:53",
        "Origin": "Terraform",
        "Project": "Cloud Project"
      },
      "versioning": [
        {
          "enabled": false,
          "mfa_delete": false
        }
      ],
      "website": [],
      "website_domain": null,
      "website_endpoint": null
    },
    "private": "bnVsbA=="
  }
]

Additional context
Attached is the terraform.tfstate file to read from. I had to rename it to .txt so as to be able to attach it to this issue. You can rename back to .tfstate on your local machine

terraform.tfstate.txt

@TomKlimovski TomKlimovski added the enhancement New feature or request label Apr 22, 2021
@tomklimovskigamma tomklimovskigamma linked a pull request May 14, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0