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.
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
[FEATURE] readplan #13
Open
Open
@TomKlimovski

Description

@TomKlimovski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0