#terraform-0_12 - March 2020

38 messages

Discuss upgrading to terraform 0.12

Archive: https://archive.sweetops.com/terraform-0_12/

March 2020
curious deviant
curious deviantover 6 years ago
Hello,
I have a multi-account setup wherein my domain (myexampledomain.com)is registered in ACCOUNT A and I need to create a subdomain in ACCOUNT B (I have created a HZ for (myexampledomain.com) . and need to add a subdomain say (sub.myexampledomain.com). I am using DNS Validation for AWS cert and figured that DNS validation needs to add an entry in ACCOUNT A. I setup a cross account role in ACCOUNT A and corresponding permissions in ACCOUNTB. However the terraform (0.12) is unable to assume role. I can atleast assume role via aws cli. What am I missing ?
Matthew King
Matthew Kingover 6 years ago
Can I ask a dumb question? if I have existing terraform code, is there an easy way to convert it to a module so it can be used over and over again?
joshmyers
joshmyersover 6 years ago
Any ways to keep the ordering of a map?
joshmyers
joshmyersover 6 years ago
map("year", "string", "month", "string", "day", "string", "hour", "string")
{
  "day" = "string"
  "hour" = "string"
  "month" = "string"
  "year" = "string"
}
loren
lorenover 6 years ago
I think you would need to maintain order in a list of key values
joshmyers
joshmyersover 6 years ago
Aye, figured so, thanks!
joshmyers
joshmyersover 6 years ago
2 lists and zipmap together I guess is another option
Matthew King
Matthew Kingover 6 years ago
I’m looking at combining three different things, one enabling cloud-watch cloud-trail, two creating the aws_kms_key, and three pushing those notifications to slack. Best way would be to just combine them all into seperate modules correct?
btai
btaiover 6 years ago
anyone getting this when deprovisioning an eks cluster:
Error: Cycle: module.eks_cluster.output.endpoint, kubernetes_cluster_role_binding.auditboard_admin_cluster_admin (destroy), kubernetes_service_account.auditboard_admin (destroy), module.eks_cluster.aws_eks_cluster.default (destroy), module.eks_cluster.local.certificate_authority_data_list, module.eks_cluster.local.certificate_authority_data_list_internal, module.eks_cluster.local.certificate_authority_data_map, module.eks_cluster.local.certificate_authority_data, module.eks_cluster.output.certificate_authority_data, provider.kubernetes, kubernetes_config_map.aws_auth (destroy)
Matthew King
Matthew Kingover 6 years ago
I’m trying to implement the aws cloudtrail cloudwatch alarms terraform and when I run it, I receive the following error
Matthew King
Matthew Kingover 6 years ago
Error: Creating/Updating CloudWatch Log Metric Filter failed: ResourceNotFoundException: The specified log group does not exist.

  on alarms.tf line 76, in resource "aws_cloudwatch_log_metric_filter" "default":
  76: resource "aws_cloudwatch_log_metric_filter" "default" {
Brandon Wilson
Brandon Wilsonover 6 years ago
Anyone know if there’s a cleaner way to do this var.branch == "master" ? "${var.service}" : (var.branch == "staging" ? "${var.service}" : (var.branch == "compliance" ? "${var.service}" : "${var.service}-${var.branch}"))
Brandon Wilson
Brandon Wilsonover 6 years ago
something like var.branch == "master||staging||compliance" ? "${var.service}" ?
loren
lorenover 6 years ago
contains()?
Brandon Wilson
Brandon Wilsonover 6 years ago
well, I hesitate to use contains in case the word in somewhere in the else name
loren
lorenover 6 years ago
it matchs a value against a list of values and returns true/false
Brandon Wilson
Brandon Wilsonover 6 years ago
so it would be an exact match?
Brandon Wilson
Brandon Wilsonover 6 years ago
Oh I see that now
Brandon Wilson
Brandon Wilsonover 6 years ago
determines whether a given list or set contains a given single value as one of its elements.
Brandon Wilson
Brandon Wilsonover 6 years ago
yeah this would work
loren
lorenover 6 years ago
contains(["master", "staging", "compliance"], var.branch) ? var.service : "${var.service}-${var.branch}"
Brandon Wilson
Brandon Wilsonover 6 years ago
I could probably clean it up even more keep the list outside of that yeah?
loren
lorenover 6 years ago
not sure i wholly got your branching right, but something like that
Brandon Wilson
Brandon Wilsonover 6 years ago
yeah you’ve got the idea
loren
lorenover 6 years ago(edited)
absolutely, yes, can keep the list in a separate local/var
Brandon Wilson
Brandon Wilsonover 6 years ago
I think I’ll do that. Thanks @loren 🙂
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago(edited)
locals {
  default_branch_mapping = var.service
  branch_mapping = {
    "foobar" = var.service + "-" + var.branch
    "compliance" = var.service + "-" + var.branch
  } 

  my_name = lookup(local.branch_mapping, var.branch, local.default_branch_mapping)
}
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Brandon Wilson wouldn't something like this work?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Adding @U010XGY9B46 bot
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Hrm....
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Maybe it's time we archive this channel as terraform 0.12 is more or less the norm now?
Joe Presley
Joe Presleyover 6 years ago
Can you rename it for v0.13 release? 😉
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
haha, ya maybe that's the right thing to do
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
though I think better to start a clean channel with no history for 0.13
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
any eta's on when 0.13 is actual?
Joe Presley
Joe Presleyover 6 years ago
My magic Google 8-ball comes up empty.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Alright, gonna archive this channel to reduce confusion. When 0.13 is eminent and if it comes with tons of breaking changes like 0.12 (hoping not!) we'll create a new one.
erik
erikover 6 years ago
archived the channel