Skip to content

How to check in terraform aws buckets have a server-side encryption enabled? #734

Closed Answered by chris-rock
chris-rock asked this question in Q&A
Discussion options

You must be logged in to vote

Yes you can do that with the current query capabilities. When you create a .tf file with the above content, start the cnspec shell via:

 cnspec shell terraform example.tf  

In the shell you can ask for all resources define in the terraform HCL file:

cnspec> terraform.resources { * } 
terraform.resources: [
  0: {
    type: "resource"
    end: terraform.fileposition id = file.position/example.tf/1/1
    labels: [
      0: "aws_s3_bucket"
      1: "aes-encrypted-bucket"
    ]
    nameLabel: "aws_s3_bucket"
    blocks: []
    arguments: {
      bucket: "my-aes-encrypted-bucket"
      tags: {
        Environment: "dev"
      }
    }
    start: terraform.fileposition id = file.position/example.tf

Replies: 1 comment

Comment options

chris-rock
Jan 6, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by imilchev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant