Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
terraform_wrapper: false
- uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.11"
- name: Install Custodian
run: |
pip install c7n_left
Expand Down
19 changes: 19 additions & 0 deletions policies/cost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
policies:
- name: check-ebs-volume-type
description: "use gp3 volumes for better cost and performance over gp2"
resource: terraform.aws_instance
metadata:
severity: low
categories: [cost]
filters:
- or:
- type: value
key: root_block_device.volume_type
value: gp2
- type: value
key: ebs_block_device.volume_type
value: gp2
# - type: list-item
# key: ebs_block_device
# attrs:
# - volume_type: gp2
32 changes: 32 additions & 0 deletions root-module/ec2.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
data "aws_ami" "ubuntu" {
most_recent = true

filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}

owners = ["099720109477"] # Canonical
}

resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
instance_type = "m6g.large"

ebs_block_device {
device_name = "/dev/sdf"
volume_type = "gp2"
volume_size = "30"
}

tags = {
Name = "HelloWorld"
Env = "Dev"
}

}