#terraform-aws-modules (2020-05)

terraform Terraform Modules

Discussions related to https://github.com/terraform-aws-modules

Archive: https://archive.sweetops.com/terraform-aws-modules/

2020-05-05

sheldonh avatar
sheldonh

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.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

@Andriy Knysh (Cloud Posse)

1
Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

@sheldonh thanks for your contribution

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

the module is not converted to TF 0.12 yet

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

I can review your 0.12 changes for 0.11 version and if ok, will merge

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

but it’s not a long-term solution, we need to convert it to TF 0.12 and add tests. We have a few modules in the pipeline, this one will be converted soon

sheldonh avatar
sheldonh

I didn’t change I just flagged the PR . . I would love to have done it but no sense redoing someone else’s work. I think they submitted 0.12 changes

2020-05-08

Carlos R. avatar
Carlos R.

Hello all, quick question, why do you guys use this enable flag in all your modules?

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

@Carlos R. this is not the correct channel (not about CloudPosse modules), but anyway, here is a short answer

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

imagine you use the same TF code (a set of modules) for many diff environments (prod, staging, dev, testing)

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

and you have settings for all of those environments in xxx.tfvars files (where xxxx is the env name)

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

now, you have the same code for all environments, e.g. RDS, EMR, ElasticSearch, etc.

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

but if you don’t want to deploy some of the modules to some of the environments, let’s say you don’t want Elastcsearch and EMR on dev/testing to save on cost, you set enabled=false only for those environments

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

so without changing/updating or commenting out any of the code, you can control what you want to deploy to each environment. You can also destroy a module by simply setting enabled=false on it

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

there are more small use-cases for that, but this is the main one

Carlos R. avatar
Carlos R.

Ty for the reply @Andriy Knysh (Cloud Posse) I was wondering that would be something like that. I was trying to understand if that’s a good practice or not in case I do my own module. It seems important at least until they release tf 0.13

Carlos R. avatar
Carlos R.

again apologies for asking in the wrong channel and ty for the prompt reply

sheldonh avatar
sheldonh

Dang. Had no idea 0.13 was even a thing. Reading the change log I couldn’t even get a feel for eta but the decentralized providers piece intriguing. Not sure what it means

2020-05-13

2020-05-14

Jim Park avatar
Jim Park

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?

Fix creation of Redis in cluster mode by samsullivan · Pull Request #65 · cloudposse/terraform-aws-elasticache-redis

what fix creation on cluster_mode_enabled don't send number_cache_clusters or availability_zones for cluster mode why neither parameter are supported for cluster mode; more info: number_cac…

1
Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

thanks @Jim Park

Fix creation of Redis in cluster mode by samsullivan · Pull Request #65 · cloudposse/terraform-aws-elasticache-redis

what fix creation on cluster_mode_enabled don't send number_cache_clusters or availability_zones for cluster mode why neither parameter are supported for cluster mode; more info: number_cac…

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

Codefresh is down so we can’t run our tests now

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

once it’s working again, will run tests and merge if ok

1

2020-05-20

Rajesh Babu Gangula avatar
Rajesh Babu Gangula

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
  }
}

2020-05-21

Igor avatar

@Rajesh Babu Gangula Have you tried just adding another ebs_block_device block and running a plan?

Rajesh Babu Gangula avatar
Rajesh Babu Gangula

That works but I want to have it as an arbitrary option

Rajesh Babu Gangula avatar
Rajesh Babu Gangula

Tried dynamic block but it did not work as expected

David avatar

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

terraform-providers/terraform-provider-aws

Terraform AWS provider. Contribute to terraform-providers/terraform-provider-aws development by creating an account on GitHub.

2020-05-29

RB avatar
Use old arn format by nitrocode · Pull Request #53 · cloudposse/terraform-aws-ecs-alb-service-task

what If the old arn format is still used, then this module should not tag the service as that’s not possible with the old arn. why Fixes #50 references N/A

RB avatar

also @Andriy Knysh (Cloud Posse) this is the one that i really want to push through, if possible

Use old arn format by nitrocode · Pull Request #53 · cloudposse/terraform-aws-ecs-alb-service-task

what If the old arn format is still used, then this module should not tag the service as that’s not possible with the old arn. why Fixes #50 references N/A

    keyboard_arrow_up