#terraform-aws-modules - May 2020

sheldonh
sheldonhover 6 years ago
Very cool! @Erik Osterman (Cloud Posse) you guys might look at this if you get the time. https://github.com/cloudposse/terraform-aws-rds-cloudwatch-sns-alarms/pull/18

Looks like the one blocker for me in the past was resolved by rfvermut contribution.
Carlos R.
Carlos R.over 6 years ago
Hello all, quick question, why do you guys use this enable flag in all your modules?
Jim Park
Jim Parkover 6 years ago
Hi there, we’ve encountered a bug with terraform-aws-elasticache-redis that I believe https://github.com/cloudposse/terraform-aws-elasticache-redis/pull/65 resolves. Could we get a review please?
Rajesh Babu Gangula
Rajesh Babu Gangulaover 6 years ago
hello I am having the following code to create a launch configuration which creates one secondary volume but I need to create multiple EBS volumes as per the requirement ... can anyone suggest what would be the best approach to have that functionality
resource "aws_launch_configuration" "launch_config_with_secondary_ebs" {
  count = var.secondary_ebs_volume_size != "" ? 1 : 0

  ebs_optimized     = var.enable_ebs_optimization
  enable_monitoring = var.detailed_monitoring
  image_id          = var.image_id != "" ? var.image_id : data.aws_ami.asg_ami.image_id
  instance_type     = var.instance_type
  key_name          = var.key_pair
  name_prefix       = join("-", compact(["LaunchConfigWith2ndEbs", var.name, format("%03d-", count.index + 1)]))
  placement_tenancy = var.tenancy
  security_groups   = var.security_groups
  user_data_base64  = base64encode(data.template_file.user_data.rendered)

  ebs_block_device {
    device_name = local.ebs_device_map[local.ec2_os]
    encrypted   = var.secondary_ebs_volume_existing_id == "" ? var.encrypt_secondary_ebs_volume : false
    iops        = var.secondary_ebs_volume_iops
    snapshot_id = var.secondary_ebs_volume_existing_id
    volume_size = var.secondary_ebs_volume_size
    volume_type = var.secondary_ebs_volume_type
  }

  iam_instance_profile = element(
    coalescelist(
      aws_iam_instance_profile.instance_role_instance_profile.*.name,
      [var.instance_profile_override_name],
    ),
    0,
  )

  root_block_device {
    iops        = var.primary_ebs_volume_type == "io1" ? var.primary_ebs_volume_size : 0
    volume_size = var.primary_ebs_volume_size
    volume_type = var.primary_ebs_volume_type
  }

  lifecycle {
    create_before_destroy = true
  }
}

Igor
Igorover 6 years ago
@Rajesh Babu Gangula Have you tried just adding another ebs_block_device block and running a plan?
Rajesh Babu Gangula
Rajesh Babu Gangulaover 6 years ago
That works but I want to have it as an arbitrary option
Rajesh Babu Gangula
Rajesh Babu Gangulaover 6 years ago
Tried dynamic block but it did not work as expected
David
Davidover 6 years ago
The docs are a bit unclear, but if you look in the provider code it's clear that multiple ebs blocks are supported, so dynamic should be the way to go.

Could you show us what you've tried so far with using dynamic blocks?

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_launch_configuration.go#L161-L162