Skip to content

Commit

Permalink
add: precondition for ec2 instancet_ype
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdn committed Mar 9, 2024
1 parent 3bffed6 commit 91325fc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ resource "aws_launch_configuration" "example" {
# ASG がある起動設定を使う場合は必須
lifecycle {
create_before_destroy = true
precondition {
condition = data.aws_ec2_instance_type.instance.free_tier_eligible
error_message = "${var.instance_type} is not free-tier."
}
}
}

Expand Down Expand Up @@ -136,6 +140,10 @@ resource "aws_cloudwatch_metric_alarm" "low_cpu_credit_balance" {
unit = "Count"
}

data "aws_ec2_instance_type" "instance" {
instance_type = var.instance_type
}

locals {
tcp_protocol = "tcp"
all_ips = ["0.0.0.0/0"]
Expand Down

0 comments on commit 91325fc

Please sign in to comment.