#terraform-aws-modules - June 2019

Mike Nock
Mike Nockover 7 years ago
Hey all, does anyone have some recommendations on a terraform module setup for an ecs fargate cluster setup? It needs to support 4 services per cluster, alb, possible nginx side car container integration.
Thoughts? I had one working for a while, but the tags broke.
Steven
Stevenover 7 years ago
I'm in the process of upgrading mine for fargate support. Need to finish it this week. Have too many things that need it
Mike Nock
Mike Nockover 7 years ago
There was an awesome module by azavea but the tags broke on it for TFE, so I gotta find a new module. The last one was perfect, created the ALB, the ECS cluster, multiple services.
Mike Nock
Mike Nockover 7 years ago
autoscaling policies, etc. Preferably I could find another one like it, but if I have to use multiple, oh well. What are you using in your setup?
Steven
Stevenover 7 years ago
Mine handles ECS service on ECS2, alb, , tags, and things. It is for a service. So, you can create as many services as needed. Both container and task definitions can be overridden for more complex setups (like sidecars, proxies). Partial fargate support is there. But not awsvpc networking yet
Steven
Stevenover 7 years ago
Also, this conversation should be in #terraform
Mike Nock
Mike Nockover 7 years ago
That's a pretty nice module. Is there a way to output the ALB DNS name for R53 records?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@David Latham please make sure you never pin to master in any of your infrastructure code
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
(it's not possible to maintain backwards compatibility between releases and pinning to a release is the only way to ensure stability in a global ecosystem of terraform modules)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
use 0.11.1 or earlier
ian
ianover 7 years ago
really really stupid question but I'm so lost: i'm trying to provision a cross-region rds replica but I can't figure out how to create KMS keys for two different regions (us-east-2 for the source db and us-west-2 for the replica db). Do I resource two aws_kms_key and specify the region somehow?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@ian are you using one of these modules: https://github.com/terraform-aws-modules/
ian
ianover 7 years ago
no a senior dev has rolled his own setup but it's similar to those modules and I can use them as a reference
Ren Roz
Ren Rozover 7 years ago
Has anyone tested provisioner during terraform destroy? Destroy-Time Provisioners
<https://www.terraform.io/docs/provisioners/index.html>
Ren Roz
Ren Rozover 7 years ago
We are currently testing it and destroy handle doesn't seem to pick up.... If someone has tested, please advise?
Mike Nock
Mike Nockover 7 years ago
Hey guys, using this module: https://github.com/cloudposse/terraform-aws-s3-log-storage?ref=master
and running into an issue where the ALBs I'm creating don't have access to the bucket. Is that an attribute input I need to set?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Mike Nock
Mike Nockover 7 years ago
Ah my apologies. I'll use terraform channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
thx!
cabrinha
cabrinhaover 7 years ago
anyone have an AWS AppMesh terraform module they're working on? 😄
Steven
Stevenover 7 years ago
Not yet. Will probably be on my project list next month
cabrinha
cabrinhaover 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Jamie Nelson (BitFlight) ☝️
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
@Jamie Nelson (BitFlight) has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@cabrinha meet @Jamie Nelson (BitFlight) 😃
cabrinha
cabrinhaover 7 years ago
👌
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
hi 🙂
cabrinha
cabrinhaover 7 years ago
hello
cabrinha
cabrinhaover 7 years ago
let me know if you need any help on the app mesh module, it looks great so far
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
@cabrinha when did you need it by? I am starting by making an mvp using terraform 0.12, and I’m not going to include all of the node features like logging and health checks at the start
cabrinha
cabrinhaover 7 years ago
i'd like to use terraform 0.11
cabrinha
cabrinhaover 7 years ago
and need? well the sooner the better 😄
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
So once the mvp is done, you can do pr’s to add in other features and such
cabrinha
cabrinhaover 7 years ago
Error downloading modules: Error loading modules: module virtual_router_label: duplicated. module names must be unique
cabrinha
cabrinhaover 7 years ago
this is the error I get as it sits now
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Lol. Yeah it’s not ready yet I’ve only been writing it for about 3.5 hours
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
(that means Jamie will have a few PRs open in ~30m)
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Ha.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
It’s 7pm for me and I was about to have a beer. I am gonna keep going tomorrow:)
cabrinha
cabrinhaover 7 years ago
👌
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
🍻
cabrinha
cabrinhaover 7 years ago
🍺
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Btw @cabrinha are you using an existing module to create your services and ecs cluster?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Like airship?
cabrinha
cabrinhaover 7 years ago
nope, we use our own in-house module
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Ok. So to make app mesh work the task definitions have to have an extra two sidecar containers running in them
cabrinha
cabrinhaover 7 years ago
sure, envoy and xray
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Yeah.
cabrinha
cabrinhaover 7 years ago
thats easy, i've got my task-definition sorted out already
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
So what I’ll do it create a template wrapper for generating the task def
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
That adds the sidecars as well
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
So you can pass in your container def, and ports, and app mesh name, and it outputs the full task def
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
With the ports, proxy, and labels in place
cabrinha
cabrinhaover 7 years ago
hm ok that sounds cool
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
I’ll need to make it for when I do the example anyway
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Anyway, I’ll update it further tomorrow
cabrinha
cabrinhaover 7 years ago
⛵️
cabrinha
cabrinhaover 7 years ago
Blaise Pabon
Blaise Pabonover 7 years ago
(I think I will need to watch a video or adjust my meds, because I didn't understand that announcement...)
Blaise Pabon
Blaise Pabonover 7 years ago
(oh, boy, I just noticed the video is from AWS Summit Anaheim and I was at that show ...I guess I must not have been paying attention.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
@cabrinha this app mesh module's example is getting bigger than the actual module
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
haha
cabrinha
cabrinhaover 7 years ago
lel
cabrinha
cabrinhaover 7 years ago
yeah thats expected when you're making on ECS cluster, VPC and all that
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
I have a few things still to do today:
- Complete the codepipeline build and deploy to ecr from s3 source
- Complete the task wrapper
- Complete the IAM roles required for running the tasks
- Complete the ECS Service Update pipeline
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
@Callum Robertson this channel will help you.
Callum Robertson
Callum Robertsonover 7 years ago
@Callum Robertson has joined the channel
cabrinha
cabrinhaover 7 years ago
Looks like I'm having some issue with the EKS module https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/4.0.2
cabrinha
cabrinhaover 7 years ago
kubectl get svc
cabrinha
cabrinhaover 7 years ago
NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
exiled-marmot-mysql   ClusterIP   172.20.29.176   <none>        3306/TCP   2d
kubernetes            ClusterIP   172.20.0.1      <none>        443/TCP    3d
cabrinha
cabrinhaover 7 years ago
is there no way to get VPC IPs now?
cabrinha
cabrinhaover 7 years ago
hm, maybe its just the subnet tagging that I was missing
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
@cabrinha the latest version of the dynamic subnet module handles the public private subnet tagging correctly.
cabrinha
cabrinhaover 7 years ago
nice thanks
cabrinha
cabrinhaover 7 years ago
are there tags needed?
cabrinha
cabrinhaover 7 years ago
never saw any docs on that
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
It depends. Many of the kubernetes services that need to access and discover aws resources require that those resources are tagged in a way that relates to the kubernetes cluster
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Such as Spinnaker.io and cpco.io
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago(edited)
The dynamic subnets module allows you to specify a tag and a value
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
i preferred the dynamic sinners module myself
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 7 years ago
Ha
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago(edited)
https://github.com/cloudposse/terraform-aws-dynamic-subnets was converted to TF 0.12, real tests added (using bats and terratest), the tests create real resources in AWS and check them
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@cabrinha regarding what @Jamie Nelson (BitFlight) said, there are two variables https://github.com/cloudposse/terraform-aws-dynamic-subnets/blob/master/variables.tf#L1 and https://github.com/cloudposse/terraform-aws-dynamic-subnets/blob/master/variables.tf#L7 which you can use to implement any type of tagging for the subnets
cabrinha
cabrinhaover 7 years ago
yeah we're just starting to get into EKS now, most of our AppMesh stack is for use in ECS
Phu Bar
Phu Barover 7 years ago(edited)
Hi guys, I'm having trouble accessing the kibana web interface via a browser after running the terraform module.

I'm connect to a VPN and allowed the VPN cidr block to access the es cluster yet when I hit the kibana link, I get {"Message":"User: anonymous is not authorized to perform: es:ESHttpGet"}.

I tried adding the cidr block to the access policy but I get UpdateElasticsearchDomainConfig: {"message":"You can’t attach an IP-based policy to a domain that has a VPC endpoint. Instead, use a security group to control IP-based access."}

I can use the domain template to not require signing request with iam credential, which does allow me to access kibana but this is not my ideal way to set it up.