#terraform-aws-modules - April 2019

Mike Nock
Mike Nockover 7 years ago
Morning all. Sorry if this is the wrong channel but:
Would anyone happen to know if this module can be used to dynamically create 255 /24 subnets?
https://github.com/cloudposse/terraform-aws-dynamic-subnets/
Vidhi Virmani
Vidhi Virmaniover 7 years ago
Hello terraformers,
I am using this eks module https://github.com/terraform-aws-modules/terraform-aws-vpc and recieving this error
Error: module.eks_cluster.aws_eks_cluster.this: vpc_config.0: invalid or unknown key: endpoint_private_access
Vidhi Virmani
Vidhi Virmaniover 7 years ago
Can anyone help?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@Vidhi Virmani i think you are using https://github.com/terraform-aws-modules/terraform-aws-eks, ping @antonbabenko for help with the module
Vidhi Virmani
Vidhi Virmaniover 7 years ago
Thanks @Andriy Knysh (Cloud Posse). I have messaged him.
antonbabenko
antonbabenkoover 7 years ago
Open an issue in that repo and maybe someone will be able to help with EKS module.
Pablo Costa
Pablo Costaover 7 years ago
Try to update the aws provider: "terraform init -upgrade" because endpoint private access is a recent feature
Igor
Igorover 7 years ago
@antonbabenko Is there a way to add custom providers to terraform-aws-atlantis without making a new atlantis image?
antonbabenko
antonbabenkoover 7 years ago
Do you mean terraform providers which you can use in your terraform configs?
Igor
Igorover 7 years ago
Yes
antonbabenko
antonbabenkoover 7 years ago
You can call custom command/script (https://www.runatlantis.io/docs/custom-workflows.html#custom-init-plan-apply-commands) which will download providers before running terraform plan
antonbabenko
antonbabenkoover 7 years ago
but I think embedding them into an image is good option if you are not going to change them very often.
Igor
Igorover 7 years ago
I thought of that, but concluded it's too hacky.. haha
antonbabenko
antonbabenkoover 7 years ago
agree
Igor
Igorover 7 years ago
Thank you
Edd
Eddover 7 years ago
Hey folks, I'm trying to use this module - https://registry.terraform.io/modules/cloudposse/cloudfront-s3-cdn/aws/0.7.0 - and am encountering a CORS error when Terraform is setting up the S3 bucket
Edd
Eddover 7 years ago

* module.cloudfront-s3-cdn.aws_s3_bucket.origin: 1 error(s) occurred:

* aws_s3_bucket.origin: Error putting S3 CORS: MalformedXML: The XML you provided was not well-formed or did not validate against our published schema
        status code: 400, request id: B49313C1B360E967, host id: 9CNDQqYA3/F0FAXlsFPIYVhAAJZoYiYQrBo/sZ1K8ZohYGgSNNJVYL3FOCDUB0fCs+wq4JftevE=
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Hey @Edd this channel is for https://github.com/terraform-aws-modules/
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
maybe try #terraform
cabrinha
cabrinhaover 7 years ago
anyone ever use this module? https://github.com/terraform-aws-modules/terraform-aws-security-group/tree/v2.16.0

in the readme example, they're passing in a VPC ID as a CIDR block for a security group rule
module "db_computed_merged_sg" {
  # omitted for brevity

  computed_ingress_cidr_blocks = ["10.10.0.0/16", "${data.aws_security_group.default.id}", "${module.vpc.vpc_id}"]
  number_of_computed_ingress_cidr_blocks = 3
}

but I'm having some issue doing the same
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago(edited)
@cabrinha just briefly looking at the code above (I did not use the module), looks like both "${data.aws_security_group.default.id}", "${module.vpc.vpc_id}" do not return CIDR blocks - they return IDs
cabrinha
cabrinhaover 7 years ago
exactly, so im wondering if its supposed to be possible to pass in a VPC ID into the module
cabrinha
cabrinhaover 7 years ago
maybe i should just open an issue asking that question
Noah Kernis
Noah Kernisover 7 years ago
Hi all, I have a question about this module (let me know if I am asking in the wrong channel!) https://github.com/cloudposse/terraform-aws-ecs-web-app?ref=tags/0.5.0 . Is there a way to create a task definition with multiple images defined? It seems possible via this module - https://github.com/cloudposse/terraform-aws-ecs-container-definition/blob/master/examples/multiple_definitions/main.tf - but this is being used by the terraform-aws-ecs-web-app and I believe I can't pass directly to it. Thank you for any and all help?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
hi @Noah Kernis let’s move to #terraform
Noah Kernis
Noah Kernisover 7 years ago
@Andriy Knysh (Cloud Posse) moving there
cabrinha
cabrinhaover 7 years ago
I feel like we should be able to override certain tags/names
cabrinha
cabrinhaover 7 years ago
like namespace -- this means nothing to me or my org
cabrinha
cabrinhaover 7 years ago(edited)
but it turns out the name of the DNS record created is affected by this and I have no control over that DNS name
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
in the end, the cloudposse modules are designed to be internally consistent
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
due to limitations of the HCL language, we cannot easily accommodate the differences in naming conventions
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
(for example, environment vs stage)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
this is quite opinionated, but is the only way we've been able to manage writing 140+ terraform modules that work relatively well together 😃
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
why not use the established convention namespace-stage-name? what’s wrong with using `namespace? 🙂 It could be your org name or abbreviation, or just something else specific to your use-case
cabrinha
cabrinhaover 7 years ago
i feel like it could be easy to override the tags or leave them out
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
(nothing is easy when the change means percolating it out to 140 repositories = 140+ pull requests)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
so the main reason of doing that is to have consistent and globally unique names for ALL AWS resources
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
especially for global resources like S3 buckets
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
where you can easily have naming conflicts
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
so by using everything consistently, we usually eliminate the possibilities of conflicts (on global resources as well)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
when you automate everything, naming global AWS resources is difficult
cabrinha
cabrinhaover 7 years ago
👌
cabrinha
cabrinhaover 7 years ago
thats fine and makes sense
cabrinha
cabrinhaover 7 years ago
i guess i can still add my own additional tags
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
so why not use the same patterns to name ALL resources? it’s easy to automate w/o thinking about it
cabrinha
cabrinhaover 7 years ago
i just dont like that this EFS module created a DNS record prefixed with eg-
cabrinha
cabrinhaover 7 years ago
eg-$my_env-$my_name-efs.$my_domain
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
so that's a great name 😃 however, a CNAME to your service discovery domain would be even nicer
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
the e.g. is for "Example given"
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
we default to that ugly prefix so users change it 😃
cabrinha
cabrinhaover 7 years ago
i'd love to have service discovery here, we're working on that
cabrinha
cabrinhaover 7 years ago
yeah so ... changing it...
cabrinha
cabrinhaover 7 years ago
why can i change but not omit?
cabrinha
cabrinhaover 7 years ago(edited)
i just want $my_env-$my_name-efs.$my_domain as the cname
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I think in current versions of terraform-null-label we don't enforce the namespace, however, it's not been percolated out
cabrinha
cabrinhaover 7 years ago
perhaps i could open a PR 😄
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
that said, from a consistency perspective, i don't like it since it leads to inconsistency and while that works in smaller infrastructures it falls apart at scale.
cabrinha
cabrinhaover 7 years ago
a naming convention is a naming convention ... as long as it's consistent, it can be xyz-efs.$my_domain -- users should be able to create their own conventions
cabrinha
cabrinhaover 7 years ago
not sure if this is where i'm supposed to be looking
cabrinha
cabrinhaover 7 years ago(edited)
cabrinha
cabrinhaover 7 years ago
I'm not sure I'm understanding how all these modules are chained together, but I think it's understood what I'm trying to do.
cabrinha
cabrinhaover 7 years ago
actually, by setting namespace to an empty string, it works!
cabrinha
cabrinhaover 7 years ago
BUT
cabrinha
cabrinhaover 7 years ago(edited)
I still would like complete control over the DNS name that gets created. Why not offer that to users of the module and if nothing is set, it'll use the defaults currently in place?
cabrinha
cabrinhaover 7 years ago
I feel like there should just be simple way to override the naming of these things.
cabrinha
cabrinhaover 7 years ago
From looking at the code, it's kind of hard to tell how the DNS CNAME is going to come out the other end.
cabrinha
cabrinhaover 7 years ago
@Erik Osterman (Cloud Posse) @Andriy Knysh (Cloud Posse) what do you think? https://github.com/cloudposse/terraform-aws-efs/pull/25
cabrinha
cabrinhaover 7 years ago(edited)
If you guys want me to update the docs and stuff like that just lmk if we can move this forward.
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@cabrinha thanks, reviewed the PR
cabrinha
cabrinhaover 7 years ago
Updated 👌
cabrinha
cabrinhaover 7 years ago
SO nice to be able to get an option added to this module within the cours of a couple hours!
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
next time, let’s do it in #terraform
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
cabrinha
cabrinhaover 7 years ago
will do
Roger Gomez
Roger Gomezover 7 years ago
Hi, is there any option on terraform-aws-cloudtrail to configure a trail for an organization?
Roger Gomez
Roger Gomezover 7 years ago
For all member accounts of that organization, the option is_organization_trail on the aws_cloudtrail
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
@Roger Gomez https://github.com/cloudposse/terraform-aws-cloudtrail was created before AWS added CloudTrail for organizations
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
you can open a PR to add is_organization_trail
Roger Gomez
Roger Gomezover 7 years ago
ok, I will do that, thanks, working on it now
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
let’s move to #terraform , this channel is for https://github.com/terraform-aws-modules/