Skip to content

Commit

Permalink
feat: remove security group argument
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Sep 27, 2023
1 parent 8846635 commit 4b96a73
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 74 deletions.
30 changes: 10 additions & 20 deletions _example/anomaly_example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ module "vpc" {
name = "vpc"
environment = "test"
label_order = ["name", "environment"]

cidr_block = "172.16.0.0/16"
cidr_block = "172.16.0.0/16"
}

##-----------------------------------------------------
Expand All @@ -30,7 +29,6 @@ module "public_subnets" {
environment = "test"
label_order = ["name", "environment"]


availability_zones = ["eu-west-1b", "eu-west-1c"]
vpc_id = module.vpc.vpc_id
cidr_block = module.vpc.vpc_cidr_block
Expand All @@ -49,8 +47,7 @@ module "http-https" {
name = "alarm"
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
vpc_id = module.vpc.vpc_id
}

##-----------------------------------------------------
Expand All @@ -63,10 +60,7 @@ module "ssh" {
name = "alarmsg"
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
allowed_ip = [module.vpc.vpc_cidr_block]
allowed_ports = [22]
vpc_id = module.vpc.vpc_id
}

##-----------------------------------------------------
Expand All @@ -80,7 +74,6 @@ module "ec2" {
environment = "test"
label_order = ["name", "environment"]


instance_count = 1
ami = "ami-08d658f84a6d84a80"
ebs_optimized = "false"
Expand All @@ -89,13 +82,11 @@ module "ec2" {
associate_public_ip_address = true
tenancy = "default"
subnet_ids = tolist(module.public_subnets.public_subnet_id)

assign_eip_address = "true"

ebs_volume_enabled = "true"
ebs_volume_type = "gp2"
ebs_volume_size = 30
user_data = "./_bin/user_data.sh"
assign_eip_address = "true"
ebs_volume_enabled = "true"
ebs_volume_type = "gp2"
ebs_volume_size = 30
user_data = "./_bin/user_data.sh"
}

##-----------------------------------------------------------------------------
Expand Down Expand Up @@ -130,9 +121,8 @@ module "alarm" {
InstanceId = module.ec2.instance_id[0]
}
}]
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []

alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
Expand Down
50 changes: 18 additions & 32 deletions _example/basic_example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ module "vpc" {
name = "vpc"
environment = "test"
label_order = ["name", "environment"]


cidr_block = "172.16.0.0/16"
cidr_block = "172.16.0.0/16"
}

##-----------------------------------------------------
Expand All @@ -31,7 +29,6 @@ module "public_subnets" {
environment = "test"
label_order = ["name", "environment"]


availability_zones = ["eu-west-1b", "eu-west-1c"]
vpc_id = module.vpc.vpc_id
cidr_block = module.vpc.vpc_cidr_block
Expand All @@ -47,12 +44,10 @@ module "http-https" {
source = "clouddrove/security-group/aws"
version = "2.0.0"


name = "http-https"
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
vpc_id = module.vpc.vpc_id
}

##-----------------------------------------------------
Expand All @@ -62,14 +57,10 @@ module "ssh" {
source = "clouddrove/security-group/aws"
version = "2.0.0"


name = "ssh"
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
allowed_ip = [module.vpc.vpc_cidr_block]
allowed_ports = [22]
vpc_id = module.vpc.vpc_id
}

##-----------------------------------------------------
Expand All @@ -82,7 +73,6 @@ module "ec2" {
environment = "test"
label_order = ["name", "environment"]


instance_count = 1
ami = "ami-08d658f84a6d84a80"
ebs_optimized = "false"
Expand All @@ -91,13 +81,11 @@ module "ec2" {
associate_public_ip_address = true
tenancy = "default"
subnet_ids = tolist(module.public_subnets.public_subnet_id)

assign_eip_address = "true"

ebs_volume_enabled = "true"
ebs_volume_type = "gp2"
ebs_volume_size = 30
user_data = "./_bin/user_data.sh"
assign_eip_address = "true"
ebs_volume_enabled = "true"
ebs_volume_type = "gp2"
ebs_volume_size = 30
user_data = "./_bin/user_data.sh"
}

##-----------------------------------------------------------------------------
Expand All @@ -110,18 +98,16 @@ module "alarm" {
environment = "test"
label_order = ["name", "environment"]


alarm_name = "cpu-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 2
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = 60
statistic = "Average"
threshold = 40
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []

alarm_name = "cpu-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 2
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = 60
statistic = "Average"
threshold = 40
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
Expand Down
32 changes: 10 additions & 22 deletions _example/expression_example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ module "vpc" {
name = "vpc"
environment = "test"
label_order = ["name", "environment"]

cidr_block = "172.16.0.0/16"
cidr_block = "172.16.0.0/16"
}

##-----------------------------------------------------
Expand All @@ -30,7 +29,6 @@ module "public_subnets" {
environment = "test"
label_order = ["name", "environment"]


availability_zones = ["eu-west-1b", "eu-west-1c"]
vpc_id = module.vpc.vpc_id
cidr_block = module.vpc.vpc_cidr_block
Expand All @@ -46,12 +44,10 @@ module "http-https" {
source = "clouddrove/security-group/aws"
version = "2.0.0"


name = "http-https"
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
vpc_id = module.vpc.vpc_id
}

##-----------------------------------------------------
Expand All @@ -61,14 +57,10 @@ module "ssh" {
source = "clouddrove/security-group/aws"
version = "2.0.0"


name = "ssh"
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
allowed_ip = [module.vpc.vpc_cidr_block]
allowed_ports = [22]
vpc_id = module.vpc.vpc_id
}

##-----------------------------------------------------
Expand All @@ -90,13 +82,11 @@ module "ec2" {
associate_public_ip_address = true
tenancy = "default"
subnet_ids = tolist(module.public_subnets.public_subnet_id)

assign_eip_address = "true"

ebs_volume_enabled = "true"
ebs_volume_type = "gp2"
ebs_volume_size = 30
user_data = "./_bin/user_data.sh"
assign_eip_address = "true"
ebs_volume_enabled = "true"
ebs_volume_type = "gp2"
ebs_volume_size = 30
user_data = "./_bin/user_data.sh"
}

##-----------------------------------------------------------------------------
Expand All @@ -109,7 +99,6 @@ module "alarm" {
environment = "test"
label_order = ["name", "environment"]


expression_enabled = true
alarm_name = "cpu-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
Expand Down Expand Up @@ -145,9 +134,8 @@ module "alarm" {
LoadBalancer = "app/web"
}
}]
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []

alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
Expand Down

0 comments on commit 4b96a73

Please sign in to comment.