#terraform-aws-modules - July 2019

Jeff McCollum
Jeff McCollumover 7 years ago
In the cloudposse repos, how is the terraform.md file generated in the docs folder on the repos? Some Automated script that pulls from the variables.tf?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@Jeff McCollum hi
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
this channel is not for Cloud Posse repos, it’s for https://github.com/terraform-aws-modules/
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
but to answer your question, we run the following commands:
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago

make init
make readme/deps
make readme
Jeff McCollum
Jeff McCollumover 7 years ago
Ah ok, sorry about that. Thanks I'll take a look at that.
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
build-harness gets included in the repo’s Makefile, e.g. https://github.com/cloudposse/terraform-aws-key-pair/blob/master/Makefile#L6
cabrinha
cabrinhaover 7 years ago
is there a module for an ASG with a mixed instances policy?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Bruce Dominguez
Bruce Dominguezover 7 years ago
Hi guys I am running into an issue with the module terraform-aws-cloudfront-s3-cdn. I am looking to create a S3 website backed by Cloudfront. As part of the same code I am creating:
- Route53 public hosted domain
- Cloudflare NS records
- ACM cert validated by dns
All of the above works perfectly but when I add the terraform-aws-cloudfront-s3-cdn I get
Error: Reference to undeclared resource

  on .terraform/modules/cloudfront_s3_cdn.dns/main.tf line 5, in data "aws_route53_zone" "default":
   5:   depends_on = [aws_route53_zone.this] 
Bruce Dominguez
Bruce Dominguezover 7 years ago
Any ideas? Do I need to create the Route53 resources first before running this module?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@Bruce Dominguez if terraform says undeclared resources, then check if you have those resources in the code
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
to create an S3 website with CloudFront CDN, this might help https://sweetops.slack.com/archives/CB6GHNLG0/p1562177967452800
Milos Backonja
Milos Backonjaover 7 years ago
Guys do you have idea whats wrong with subnet module which calls label?
Error: Missing resource instance key

  on .terraform/modules/private_subnets.private_label/outputs.tf line 2, in output "id":
   2:   value = "${null_resource.default.triggers.id}"

Because null_resource.default has "count" set, its attributes must be accessed
on specific instances.

For example, to correlate with indices of a referring resource, use:
    null_resource.default[count.index]

Milos Backonja
Milos Backonjaover 7 years ago
i see what the error is but is it updated to work with 12>?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Andriy Knysh (Cloud Posse) ☝️
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@Milos Backonja what module are you using? (and what terraform version?)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
if you are using https://github.com/cloudposse/terraform-aws-dynamic-subnets, it’s updated to TF 0.12
Milos Backonja
Milos Backonjaover 7 years ago
Thanks @Andriy Knysh (Cloud Posse). I tried before I post message with dynamic sub-nets module and that one is working.
I have issue with named subnets and multi-az subnets modules. I set terraform-null-label to version 0.14.0 (which is used in dynamic subnets module) and was able to eliminate errors regarding count , but I started to see new errors.
I use terraform 0.12.x
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Those are not converted to 0.12 yet
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Only dynamic subnets
Bruce Dominguez
Bruce Dominguezover 7 years ago
Thanks @Andriy Knysh (Cloud Posse) I will check out the example. 🙂
Bruce Dominguez
Bruce Dominguezover 7 years ago
Another one, I got module terraform-aws-cloudfront-s3-cdn working by creating the acm and parent zone prior to using the module. Just a quick question. Do I need to create an Alias record to now point to the created CDN?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
CDN itself uses cloudfront.net domain
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
To access the site from your domain, you need to create an alias record
Bruce Dominguez
Bruce Dominguezover 7 years ago
Thanks @Andriy Knysh (Cloud Posse) so I need to create an alias record X.mycompany.com to point to the cf_domain_name output (xxx.cloudfront.net).
Bruce Dominguez
Bruce Dominguezover 7 years ago
Thanks for the help 🙂
Bruce Dominguez
Bruce Dominguezover 7 years ago
Also is there a good fargate module?
Bruce Dominguez
Bruce Dominguezover 7 years ago
Is it best to create an ECS Fargate resource then use the modules for terraform-aws-ecs-container-definitionand terraform-aws-ecs-alb-service-task? or is there a simpler way to provision an Fargate cluster for a simple app?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@Bruce Dominguez we have a complete working example here https://github.com/cloudposse/terraform-root-modules/tree/master/aws/ecs
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
we use it to deploy atlantis on ECS Fargate
Bruce Dominguez
Bruce Dominguezover 7 years ago
Thanks @Andriy Knysh (Cloud Posse) 🙂
rohit
rohitover 7 years ago(edited)
Is there a way i can set a flag to enable/disable cross region replication using terraform-aws-modules/rds/aws moudle ? I do not want to enable replication in non production region but want it in production
rohit
rohitover 7 years ago
Is anyone aware of how to do this ?
rohit
rohitover 7 years ago
any ideas about my above question ?
joshmyers
joshmyersover 7 years ago
joshmyers
joshmyersover 7 years ago
Looks like it should do the right thing….but I noticed no versioning on the state bucket
joshmyers
joshmyersover 7 years ago
joshmyers
joshmyersover 7 years ago
from statefile ^^
joshmyers
joshmyersover 7 years ago
Manually flipped the versioning flag on the bucket, re ran a plan, no-op
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
0.12 or 0.11?
joshmyers
joshmyersover 7 years ago
0.11, using the 0.11 release of the module (0.7.0)
joshmyers
joshmyersover 7 years ago
https://github.com/terraform-providers/terraform-provider-aws/issues/8051 sounds like what I’m seeing, in terms of TF not wanting to change it back at least
joshmyers
joshmyersover 7 years ago
Not sure why it was never set though..
joshmyers
joshmyersover 7 years ago
While I remember, can we get a new release of https://github.com/cloudposse/terraform-aws-iam-account-settings/releases cut?
Bertie
Bertieover 7 years ago
what's the recommended pattern for dealing with security groups for ec2 instances? should i create them in their own plan?
Joshua Hansen
Joshua Hansenover 7 years ago(edited)
question and it may be because i’m new to tf, but using https://github.com/cloudposse/terraform-aws-rds/releases 0.9.0 - copying and pasting the example as-is i’d expect tf plan to more or less work as-is knowing i obviously need to assign the sg’s and subnets. but i’m getting more than that (attached in thread).
mmarseglia
mmarsegliaover 7 years ago
does anyone know what the aws elasticbeanstalk config option CONFIG_SOURCE is for? I can't find any aws documentation on it. https://github.com/cloudposse/terraform-aws-elastic-beanstalk-environment/blob/01d405201c192ee1948ea97bff6742140b1cfbba/main.tf#L707
Sharanya
Sharanyaover 7 years ago
Hey Folks, Trying to find some Terraform Modules related to AWS - app stream service ( for creating fleets and stacks) any help appreciated
Blaise Pabon
Blaise Pabonover 7 years ago(edited)
So I'm thinking of installing a private gitlab .... and before I cobble together these modules to reproduce their reference config (see diag below), I wanted to check here to make sure there wasn't a better way:
Blaise Pabon
Blaise Pabonover 7 years ago