#terraform-0_12 - June 2019

109 messages

Discuss upgrading to terraform 0.12

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

Shtrull
Shtrullover 7 years ago
please someone tell me what i am doing worng
Shtrull
Shtrullover 7 years ago
Shtrull
Shtrullover 7 years ago
and i am getting back
Shtrull
Shtrullover 7 years ago
Shtrull
Shtrullover 7 years ago
seems like it founr the right subent id but ignores it
Shtrull
Shtrullover 7 years ago
when i remove the module.main.web_public_subnets[0].id and hard code the subnet it works
Shtrull
Shtrullover 7 years ago
and this happens also if i make module.main.web_public_subnets output to be only one var and then remove the [0]
Shtrull
Shtrullover 7 years ago
never mind 😞 i added .id but forgot that i took the value from an output and not the resource output
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
it's dirty. it's nasty. but if you need terraform-docs to work with 0.12, it works for us.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@antonbabenko ☝️
antonbabenko
antonbabenkoover 7 years ago
Awesome! Thanks @Erik Osterman (Cloud Posse)!
Nikola Velkovski
Nikola Velkovskiover 7 years ago
A small appreciation to hands down one of the best modules out there

module "label" {
  source    = "git::<https://github.com/cloudposse/terraform-null-label.git?ref=0.12.0>"
  stage     = local.stage
  name      = local.name
  delimiter = "-"
  tags = {
    "<http://kubernetes.io/cluster/${module.label.id}|kubernetes.io/cluster/${module.label.id}>" = "shared"
  }
}
Nikola Velkovski
Nikola Velkovskiover 7 years ago
Not sure if this will work in 0.11 though.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
thanks @Nikola Velkovski!! 😃 comments like these is what keeps us going!
PePe Amengual
PePe Amengualover 7 years ago
and the salary….and food too
PePe Amengual
PePe Amengualover 7 years ago
🙂
Nikola Velkovski
Nikola Velkovskiover 7 years ago
And the coffee
Nikola Velkovski
Nikola Velkovskiover 7 years ago
😛
Maarten van der Hoef
Maarten van der Hoefover 7 years ago
@Erik Osterman (Cloud Posse) what is the problem with the current terraform-terraform-label pr for 0.12.. I'd ike to push dynamodb to 0.12. Also current travis config fails for 0.12 still if im not mistaken.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Andriy Knysh (Cloud Posse) started working on it but had to take some days off
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
We need to take a few steps with each module
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
First updating it to use Codefresh where we have all the 0.12 tooling in place
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I will try to rush this out though for you if it’s a blocker
niek
niekover 7 years ago
Hi,

I just started to upgrade the gilab-runner-spot-module (for AWS) to TF 0.12. Would be great if you can help me with the following questions.

I used the tool terraform-docs to generate documentation of the variables, this tool seems not working (yet) for 0.12. Does anybody knows / uses an alternative approach?

Does anybody has a tip what is the best way to upgrade a data "aws_ami". In my TF 0.11 module I had provided the option to inject the filter via a variable as follow:


variable "ami_filter" {
  type        = "list"

  default = [{
    name   = "name"
    values = ["amzn-ami-hvm-2018.03*-x86_64-ebs"]
  }]
}

data "aws_ami" "runner" {
  most_recent = "true"

  filter = "${var.ami_filter}"

  owners = ["${var.ami_owners}"]
}


Does anybody has a good example how I can keep the filter(s) configurable in tf 0.12?
niek
niekover 7 years ago
Oops, already hab an answer on the filter question, map with a dynamic block
davidvasandani
davidvasandaniover 7 years ago
Is it possible to taint an entire module yet?
Rohit Verma
Rohit Vermaover 7 years ago
hi all, seems like terraform-null-label is not compatible with terraform 0.12. The same module being used in all modules make them kind of unusable too
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
to use it with TF 0.12, pin to the latest release
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
to use with TF 0.11, pin to 0.11.1
Rohit Verma
Rohit Vermaover 7 years ago
then we have to change this in all the modules correct, i can send pr for the modules which we uses.
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
we have to update all the modules, we are working on it now
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
PRs are welcome, thanks 🙂
Rohit Verma
Rohit Vermaover 7 years ago
or may be a better solution is https://dependabot.com/terraform/
Rohit Verma
Rohit Vermaover 7 years ago
which should fix this across all repos for you
Rohit Verma
Rohit Vermaover 7 years ago
have you tried that?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
we are using dependabot
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
not sure if it’s possible to automatically convert everything to TF 0.12
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
works in simple cases
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
but usually you have to manually fix/update the code after the conversion
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
as far as I’ve seen it, the automatic conversion can’t work in some cases or breaks code in other cases
Rohit Verma
Rohit Vermaover 7 years ago
i though you only need to update the null-label dependency across all projects.
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
if your modules are TF 0.11 and you point them to null-label 0.12, will it work?
Rohit Verma
Rohit Vermaover 7 years ago
i didn't tried null-label 0.12 yet. What I do know is you can make null-label 0.12 work with both 0.11 and 0.12.
Rohit Verma
Rohit Vermaover 7 years ago
If its not working for any particular syntaxes, should raise a bug in terraform
Rohit Verma
Rohit Vermaover 7 years ago
anyways you can specify that modules with tag version like 2.x only support 0.12
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
will not work with TF 0.11
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
if your modules are TF 0.11
Rohit Verma
Rohit Vermaover 7 years ago
i got it, you are saying automated null-label bump is not satisfactory since you want to address tagging along with it.
Rohit Verma
Rohit Vermaover 7 years ago
anyways I will send pr for the modules which we are using.
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
i mean when you update your modules to TF 0.12 and if the modules use the label, you will bump the label version in the new TF 0.12 code
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
automated label bump to TF 0.12 in the module that supports only 0.11will not work
Rohit Verma
Rohit Vermaover 7 years ago
that i agree, but if we fixed the deps and ci runs auto terraform 0.12upgrade --yes we can easily check narrow down the errors. Few modules like https://github.com/cloudposse/terraform-aws-key-pair.git don't need anything apart from label bump and upgrade.
Rohit Verma
Rohit Vermaover 7 years ago
anyways there is a faster way which is clone all repos and do sed to replace version.
Rohit Verma
Rohit Vermaover 7 years ago
so automation won't be worth it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Dependabot is awesome but without automated tests, a sure fire way to absolutely break everything with regressions
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
We tried it on a handful of repos about a year ago and quickly things started breaking (aka GitHub issues started spiking)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
So as part of our upgrading to 0.12 we are trying to add more tests with terratest and bats
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
That way we catch regressions or at least have a way to test for them as they arise in the future
Rohit Verma
Rohit Vermaover 7 years ago
yup ci should have better tests for automations
Rohit Verma
Rohit Vermaover 7 years ago
But with 100+ modules we should work in that direction as well. I would love to help with something you required.
Rohit Verma
Rohit Vermaover 7 years ago
one more thing I would recommend is to have version.tf file. The automatic upgrade does create this file and its easy to identify current terraform version for modules by just looking at the presence of file.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Rohit Verma would massively appreciate some help
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I will type up some guidance
Rohit Verma
Rohit Vermaover 7 years ago
today i sleep, tomorrow morning I would try an approach to bump all those modules which requires lesser tinkering with some scripts.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
If you have time to do a quick call this week that would be awesome too
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Ok
Rohit Verma
Rohit Vermaover 7 years ago
the part where i got lazy is fork and raise pr 😛
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
You were working with some in house git bots, right?
Rohit Verma
Rohit Vermaover 7 years ago
yes but they are mostly chatops related thing, and work within an org
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Did you finish rolling out test-infra used by istio?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
And k8s
Rohit Verma
Rohit Vermaover 7 years ago
no but we did the vanilla prows one and hooked with tekton
Rohit Verma
Rohit Vermaover 7 years ago
you can avoid tekton and can continue use cloudfresh in parallel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Btw office hours today at 11:30 - in 1.5 hours
Rohit Verma
Rohit Vermaover 7 years ago
i got severe cold, and its already past 10 pm for me
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Oh no! Definitely get some rest
Rohit Verma
Rohit Vermaover 7 years ago
early morning person, i probably won't be able to attend any of your office hours till I am in bangalore.
Rohit Verma
Rohit Vermaover 7 years ago
Will catchup tomorrow morning with what I was able to do.
Rohit Verma
Rohit Vermaover 7 years ago
Also you need some marking strategy whether the repo is done, may be presence of version.tf or a specific tag versioning method
Rohit Verma
Rohit Vermaover 7 years ago
I would recommend version.tf
Rohit Verma
Rohit Vermaover 7 years ago
If you agree can we add that to null label repo
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
sure
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
Callum Robertson
Callum Robertsonover 7 years ago
That label module is the hotness
joshmyers
joshmyersover 7 years ago(edited)
👋 hey folks - if you were starting a new project, thoughts on using 0.12 from the get go….? cc @antonbabenko @Erik Osterman (Cloud Posse) @Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
should be ok. Not sure about it 100% since we converted just a few modules, working on the rest now
joshmyers
joshmyersover 7 years ago
Nice, any “fun” with lists of maps/other workarounds we came up with for enabled/disabed etc?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
(we did not get to those modules yet)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 7 years ago
joshmyers
joshmyersover 7 years ago
hah, I bet
joshmyers
joshmyersover 7 years ago
Cheers Andriy
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
0.12 is definitely more enjoyable
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I would start fresh with that
marc
marcover 7 years ago
are many of you guys running into:
Error: Failed to instantiate provider "aws" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]

I get this with 0.12.2.

the solutions I seem to find out there are to recompile tf, but wondered if people had a workaround?
loren
lorenover 7 years ago
What version of the aws provider are you using?
marc
marcover 7 years ago
  version             = "~> 2"
marc
marcover 7 years ago
huh, I guess
marc
marcover 7 years ago
  version             = "~> 2.16"
works
loren
lorenover 7 years ago
Ahh, they must have updated the schema version?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Rohit Verma
Rohit Vermaover 7 years ago
why have terraform-terraform-label and terraform-null-label. Are we planning to deprecate anyone?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
terraform-terraform-label was introduced as a simpler alternative to terraform-null-label which grew unwieldy in 0.11
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
with 0.12, terraform-null-label is once again sane, but we'll continue supporting terraform-terraform-label
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
and both have been updated to 0.12
Callum Robertson
Callum Robertsonover 7 years ago
Thanks @Erik Osterman (Cloud Posse) 😄