#terraform-aws-modules (2021-01)

terraform Terraform Modules

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

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

2021-01-05

Igor avatar

I must be doing something wrong, but not sure what. I am getting

A managed resource "aws_iam_user" "this" has not been declared in the root
module.

when calling

  source  = "terraform-aws-modules/iam/aws//modules/iam-user"
  version = "~> 3.0"

The resource is there. https://github.com/terraform-aws-modules/terraform-aws-iam/blob/master/modules/iam-user/main.tf#L1 Any ideas?

terraform-aws-modules/terraform-aws-iam

Terraform module which creates IAM resources on AWS - terraform-aws-modules/terraform-aws-iam

pjaudiomv avatar
pjaudiomv

what does the call to the module look like

terraform-aws-modules/terraform-aws-iam

Terraform module which creates IAM resources on AWS - terraform-aws-modules/terraform-aws-iam

Igor avatar
provider "aws" {
  region = "us-east-1"
}

module "iam_user" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-user"
  version = "~> 3.0"

  ... some vars ...
}
pjaudiomv avatar
pjaudiomv

what does the rest look like, its important to know flags and such

pjaudiomv avatar
pjaudiomv

obviously obfusicate

Igor avatar
provider "aws" {
  region = "us-east-1"
}

module "iam_user" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-user"
  version = "~> 3.0"

  name = "xxx"
}
Igor avatar
Terraform v0.14.3
+ provider registry.terraform.io/hashicorp/aws v3.22.0
pjaudiomv avatar
pjaudiomv

I am unable to reproduce i am on tested with terraform 0.14.3 and aws provider 3.22.0 with this config

provider "aws" {
  region = "us-east-1"
}

module "test-iam" {
  source        = "terraform-aws-modules/iam/aws//modules/iam-user"
  version       = "~> 3.0"
  name          = "me.test"

  pgp_key = "keybase:mykeybase"
}
Igor avatar

Okay, confirmed it was my brain not working. My module had its own output, and that’s where the error came from. Can’t believe I missed that. Thanks for the help, and sorry that it turned out to be a user error

Igor avatar

(output was in a separate outputs.tf file)

pjaudiomv avatar
pjaudiomv

no worries, glad you figured it out.

2021-01-25

diogof avatar

Hi everyone, been using ecs-alb-service-task for a long time but now I have come up with a problem: how to make 2 services on the same Cluster to communicate with one another (or better A –> B)?

Joe Niland avatar
Joe Niland

assuming they have private IPs, you have to use service discovery / CloudMap

diogof avatar

So several options all cumbersome (App Mesh, Service Discovery, etc)

Ofek Solomon avatar
Ofek Solomon
07:23:00 AM

@Ofek Solomon has joined the channel

Ofek Solomon avatar
Ofek Solomon

Hi guys, when trying to use the terraform-aws-eks-workers  module with terraform 0.14.3 im unable to do so because of the hard coded version of the terraform-aws-ec2-autoscale-group  in here , is there a reason for that? it prevents me from using the module with our current terraform version. Appreciate the help!

cloudposse/terraform-aws-eks-workers

Terraform module to provision an AWS AutoScaling Group, IAM Role, and Security Group for EKS Workers - cloudposse/terraform-aws-eks-workers

cloudposse/terraform-aws-ec2-autoscale-group

Terraform module to provision Auto Scaling Group and Launch Template on AWS - cloudposse/terraform-aws-ec2-autoscale-group

cloudposse/terraform-aws-eks-workers

Terraform module to provision an AWS AutoScaling Group, IAM Role, and Security Group for EKS Workers - cloudposse/terraform-aws-eks-workers

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

@Maxim Mironenko (Cloud Posse)

cloudposse/terraform-aws-eks-workers

Terraform module to provision an AWS AutoScaling Group, IAM Role, and Security Group for EKS Workers - cloudposse/terraform-aws-eks-workers

cloudposse/terraform-aws-ec2-autoscale-group

Terraform module to provision Auto Scaling Group and Launch Template on AWS - cloudposse/terraform-aws-ec2-autoscale-group

cloudposse/terraform-aws-eks-workers

Terraform module to provision an AWS AutoScaling Group, IAM Role, and Security Group for EKS Workers - cloudposse/terraform-aws-eks-workers

Ofek Solomon avatar
Ofek Solomon

@Erik Osterman (Cloud Posse) @Maxim Mironenko (Cloud Posse) I cloned the module and changed the asg module version to the latest and it works fine but i really want to be able to use the original module and stay updated with the new versions

Maxim Mironenko (Cloud Posse) avatar
Maxim Mironenko (Cloud Posse)

@Ofek Solomon go ahead and try new release: <https://github.com/cloudposse/terraform-aws-eks-workers/releases/tag/0.17.0>

Julian avatar
Julian
04:15:13 AM

@Maxim Mironenko (Cloud Posse) I’m having a similar issue, and sorry, a bit more of a novice with terraform. In trying to use the following module I get the attached for a few sub-modules.

Maxim Mironenko (Cloud Posse) avatar
Maxim Mironenko (Cloud Posse)

@Julian just checked, works for me on terraform v0.14.4 and module release 0.35.0: <https://github.com/cloudposse/terraform-aws-elastic-beanstalk-environment/releases/tag/0.35.0>

Maxim Mironenko (Cloud Posse) avatar
Maxim Mironenko (Cloud Posse)

could you share your code? or check if you are using latest module version

Julian avatar

@Maxim Mironenko (Cloud Posse) I’m using tf 0.14.5

module "subnets" {
  version = ""
  source               = "git::<https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.0>"
  availability_zones   = var.availability_zones
  namespace            = var.namespace
  stage                = var.stage
  name                 = var.name
  vpc_id               = module.vpc.vpc_id
  igw_id               = module.vpc.igw_id
  cidr_block           = module.vpc.vpc_cidr_block
  nat_gateway_enabled  = true
  nat_instance_enabled = false
}

module "elastic_beanstalk_application" {
  source      = "git::<https://github.com/cloudposse/terraform-aws-elastic-beanstalk-application.git?ref=tags/0.3.0>"
  namespace   = var.namespace
  stage       = var.stage
  name        = var.name
  description = "${var.prefix}-test-application"
}


module "elastic_beanstalk_environment" {
  source = "cloudposse/elastic-beanstalk-environment/aws"
  # Cloud Posse recommends pinning every module to a specific version
  # version = "x.x.x"
  namespace                          = var.namespace
  stage                              = var.stage
  name                               = var.name
  description                        = "Test elastic_beanstalk_environment"
  region                             = var.region
  availability_zone_selector         = "Any 3"
  dns_zone_id                        = var.dns_zone_id
  elastic_beanstalk_application_name = module.elastic_beanstalk_application.elastic_beanstalk_application_name

  instance_type           = "t3.micro"
  autoscale_min           = 3
  autoscale_max           = 10
  updating_min_in_service = 0
  updating_max_batch      = 1

  loadbalancer_type       = "application"
  vpc_id                  = module.networking.vpc_id
  loadbalancer_subnets    = module.networking.public_subnet_ids
  application_subnets     = module.networking.app_subnet_ids
  allowed_security_groups = [module.networking.vpc_default_security_group_id]

  // <https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html>
  // <https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.docker>
  solution_stack_name = "64bit Amazon Linux 2 v4.1.5 running Tomcat 8.5 Corretto 11"
...
...
...
Julian avatar

and thanks for your help I’m guessing I need to edit the module version tag at the end of the source lines? I pulled the code as is from GH

Maxim Mironenko (Cloud Posse) avatar
Maxim Mironenko (Cloud Posse)

yes, update tag with most recent release of the modules. for terraform-aws-dynamic-subnets it is 0.36.0. for terraform-aws-elastic-beanstalk-application it is 0.9.0. for terraform-aws-elastic-beanstalk-environment it is 0.35.0

Julian avatar

and now… I’m a bit less a noob. lol thanks @Maxim Mironenko (Cloud Posse)

1
Ofek Solomon avatar
Ofek Solomon

@Maxim Mironenko (Cloud Posse) the tag you told me to try is working, thanks!

1

2021-01-27

2021-01-31

David Lozano avatar
David Lozano

Hi everyone, Does anyone know if it is possible to build private and public subnets with different sizes (e.g: private subnets /27, public subnets /28) using terraform-aws-dynamic-subnet module? Or all subnets will be built the same size and there is no way to modify it?

cloudposse/terraform-aws-dynamic-subnets

Terraform module for public and private subnets provisioning in existing VPC - cloudposse/terraform-aws-dynamic-subnets

Jeremy G (Cloud Posse) avatar
Jeremy G (Cloud Posse)

Not possible with that module. That module takes the given CIDR and divides it into the largest equal-sized subnets the CIDR range will hold given the number of subnets to be created.

cloudposse/terraform-aws-dynamic-subnets

Terraform module for public and private subnets provisioning in existing VPC - cloudposse/terraform-aws-dynamic-subnets

David Lozano avatar
David Lozano

Hi @Jeremy G (Cloud Posse) thank you for confirming.

    keyboard_arrow_up