Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add new ec2 instance #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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" {

Check failure on line 17 in root-module/ec2.tf

View workflow job for this annotation

GitHub Actions / Policies

terraform.aws_instance - policy:check-ebs-volume-type severity:low

use gp3 volumes for better cost and performance over gp2
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"
}

}
Loading