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

aws_cloudwatch_metric_alarm Error: insufficient items for attribute "input_format_configuration"; #9280

Closed
mzhaase opened this issue Jul 9, 2019 · 4 comments
Assignees
Labels
service/firehose Issues and PRs that pertain to the firehose service.

Comments

@mzhaase
Copy link

mzhaase commented Jul 9, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

terraform 0.12.3
provider aws 2.17.0

Affected Resource(s)

  • aws_cloudwatch_metric_alarm

Terraform Configuration Files

data "aws_ami" "latest_ecs" {
  most_recent = true
  owners = ["591542846629"] # AWS

  filter {
      name   = "name"
      values = ["amzn2-ami-ecs-hvm*-x86_64-ebs"]
  }

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

resource "aws_iam_role" "ecs-instance-role" {
    name                = "ecs-instance-role"
    path                = "/"
    assume_role_policy  = "${data.aws_iam_policy_document.ecs-instance-policy.json}"
}

data "aws_iam_policy_document" "ecs-instance-policy" {
    statement {
        actions = ["sts:AssumeRole"]

        principals {
            type        = "Service"
            identifiers = ["ec2.amazonaws.com"]
        }
    }
}

resource "aws_iam_role_policy_attachment" "ecs-instance-role-attachment" {
    role       = "${aws_iam_role.ecs-instance-role.name}"
    policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
}

resource "aws_iam_instance_profile" "ecs-instance-profile" {
    name = "ecs-instance-profile"
    path = "/"
    role = "${aws_iam_role.ecs-instance-role.id}"
    provisioner "local-exec" {
      command = "sleep 10"
    }
}

resource "aws_launch_configuration" "ecs-launch-configuration-spot" {
    name_prefix                 = "mycluster-"
    image_id                    = "${data.aws_ami.latest_ecs.id}"
    instance_type               = "t2.medium"
    iam_instance_profile        = "${aws_iam_instance_profile.ecs-instance-profile.id}"
    spot_price                  = "1"

    associate_public_ip_address = "false"
    key_name                    = "my-key"
}

resource "aws_autoscaling_group" "ecs-autoscaling-group-spot" {
  name                        = "my-asg"
  enabled_metrics             = [
    "GroupMinSize",
    "GroupMaxSize",
    "GroupDesiredCapacity",
    "GroupInServiceInstances",
    "GroupPendingInstances",
    "GroupStandbyInstances",
    "GroupTerminatingInstances",
    "GroupTotalInstances"
  ]
  max_size                    = "2"
  min_size                    = "1"
  vpc_zone_identifier         = ["my-zone" ]
  launch_configuration        = "${aws_launch_configuration.ecs-launch-configuration-spot.name}"
  health_check_type           = "EC2"

}

resource "aws_autoscaling_policy" "cpu-credit-scale-up" {
  name                   = "cpu-credit-scale-up"
  autoscaling_group_name = "${aws_autoscaling_group.ecs-autoscaling-group-spot.name}"
  adjustment_type        = "ChangeInCapacity"
  scaling_adjustment     = "1"
  cooldown               = "300"
  policy_type            = "SimpleScaling"
}

resource "aws_cloudwatch_metric_alarm" "low-cpu-credits-spot" {
  alarm_name          = "${aws_autoscaling_group.ecs-autoscaling-group-spot.name}-cpu-credits-below-30"
  alarm_description   = "cpu-credits below 30"
  comparison_operator = "LessThanOrEqualToThreshold"
  evaluation_periods  = "3"
  metric_name         = "CPUCreditBalance"
  namespace           = "AWS/EC2"
  period              = "300"
  statistic           = "Average"
  threshold           = "30"
  dimensions          = {
    "AutoScalingGroupName" = "${aws_autoscaling_group.ecs-autoscaling-group-spot.name}"
  }
  actions_enabled     = true
  alarm_actions       = [ "${aws_autoscaling_policy-spot.cpu-credit-scale-up.arn}" ]
}

Expected Behavior

Should work, and does in TF 0.11.

Actual Behavior

aws_cloudwatch_metric_alarm.low-cpu-credits-spot: Refreshing state... [id=ecs-autoscaling-group-spot-cpu-credits-below-30]
--
 
Error: insufficient items for attribute "input_format_configuration"; must have at least 1

Steps to Reproduce

  1. terraform apply
  2. terraform apply
  • #0000
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 9, 2019
@lonnix
Copy link

lonnix commented Jul 10, 2019

I just found this bug after creating an issue for the same error in a different scenario: #9304

@nywilken nywilken added the service/cloudwatch Issues and PRs that pertain to the cloudwatch service. label Jul 10, 2019
@bflad
Copy link
Contributor

bflad commented Jul 12, 2019

Hi @mzhaase 👋 Thank you for reporting this and sorry for the trouble. The aws_cloudwatch_metric_alarm resource does not have an input_format_configuration, however the aws_kinesis_firehose_delivery_stream resource does. I'm wondering if you are hitting #8982 with it reporting the input attribute instead of the output attribute.

@bflad bflad added service/firehose Issues and PRs that pertain to the firehose service. waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. labels Jul 12, 2019
@bflad bflad self-assigned this Jul 12, 2019
@bflad
Copy link
Contributor

bflad commented Jul 25, 2019

Hello again. Since we didn't hear back from you disagreeing with the above assessment, I'm going to close this issue just to consolidate it with #8982. Please follow there for further information and thank you for reporting this.

@bflad bflad closed this as completed Jul 25, 2019
@ghost
Copy link

ghost commented Nov 2, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 2, 2019
@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/firehose Issues and PRs that pertain to the firehose service.
Projects
None yet
Development

No branches or pull requests

4 participants