title: Terraform With Resource Not Found
body: <p>I am trying to create cloudwatch alert of Auto scaling group using terraform. I have used terraform module with github source for cloudwatch alert.</p>
  
  <p>My code for provisioning Auto scaling group is: </p>
  
  <pre><code>   resource "aws_launch_configuration" "main" {
       name_prefix          = "${format("%s-%s-postgres-", var.name, var.environment)}"
       instance_type        = "${var.instance_type}"
       image_id             = "${var.ami}"
       key_name             = "${var.key_name}"
       iam_instance_profile = "${aws_iam_instance_profile.server.id}"
       security_groups      = ["${var.security_groups}", "${aws_security_group.main.id}"]
       user_data            = "${data.template_file.main.rendered}"
  
    root_block_device {
      volume_size           = "${var.root_volume_size}"
      volume_type           = "gp2"
      delete_on_termination = true
    }
  
    lifecycle {
      create_before_destroy = true
    }
  }
  
  resource "aws_autoscaling_group" "main" {
    count                     = "${var.size}"
    name                      = "${var.name}-${var.environment}-postgres-asg-${count.index}"
    launch_configuration      = "${aws_launch_configuration.main.name}"
    max_size                  = "${var.max_size}"
    min_size                  = "${var.min_size}"
    desired_capacity          = "${var.desired_capacity}"
    health_check_type         = "EC2"
    health_check_grace_period = 600
    force_delete              = false
    load_balancers            = ["${aws_elb.main.name}"]
    vpc_zone_identifier       = ["${element(var.subnet_ids, count.index % length(var.subnet_ids))}"]
    termination_policies      = ["OldestLaunchConfiguration", "Default"]
    depends_on                = ["aws_launch_configuration.main"]
  
    tags = ["${list(
      map(
        "key", "Name",
        "value", "${var.name}-${var.environment}-postgres-${count.index}",
        "propagate_at_launch", true
      ),
      map(
        "key", "role",
        "value", "postgres",
        "propagate_at_launch", true
      ),
      map(
        "key", "LaunchConfigName",
        "value", "${aws_launch_configuration.main.name}",
        "propagate_at_launch", true
      ),
      map(
        "key", "ServerGroupIndex",
        "value", count.index,
        "propagate_at_launch", true
      ),
      map(
        "key", "Function",
        "value", "${var.name}",
        "propagate_at_launch", true
      ),
      map(
        "key", "Stage",
        "value", "${var.environment}",
        "propagate_at_launch", true
      )
    )}"]
  
    lifecycle {
      create_before_destroy = true
    }
  }
  </code></pre>
  
  <p>And Terraform code for cloudwatch alarms is: </p>
  
  <pre><code>module "alarm-asg-cpu" {
    source = "git::git@github.com:gruntwork-io/module-aws-monitoring.git//modules/alarms/asg-cpu-alarms?ref=v0.9.1"
    alarm_sns_topic_arns                    = ["${var.ebs_backup_sns_topic}"]
    asg_names                               = ["${aws_autoscaling_group.main.name}"]
    num_asg_names                           ="1"
    high_cpu_utilization_threshold          = "10"
    high_cpu_utilization_period             = "60"
    high_cpu_utilization_evaluation_periods = "1"
    high_cpu_utilization_statistic          = "Average"
  }
  
  module "alarm-asg-disk" {
    source = "git::git@github.com:gruntwork-io/module-aws-monitoring.git//modules/alarms/asg-disk-alarms?ref=v0.9.1"
    alarm_sns_topic_arns                     = ["${var.ebs_backup_sns_topic}"]
    asg_names                                = ["${aws_autoscaling_group.main.name}"]
    num_asg_names                            ="1"
    file_system                              = "/dev/xvdh"
    mount_path                               = "/var/lib/pgsql"
    high_disk_utilization_threshold          = "10"
    high_disk_utilization_period             = "60"
    high_disk_utilization_evaluation_periods = "1"
    high_disk_utilization_statistic          = "Maximum" 
  }
  </code></pre>
  
  <p>When I run terraform plan command. it shows the following error: </p>
  
  <p><a href="https://i.stack.imgur.com/NjW0Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NjW0Y.png" alt="enter image description here"></a></p>
  
  <p>I am stuck in this issue. How can I solve this issue? </p>