Full support for terraform-0.7.11 - #171
Conversation
In Terraform 0.7.x, template file data sources do not support the 'provisioner' parameter. So instead, we must now use a null_resource to get the discovery URL. And, unfortunately, depending on a null_resource does not mean that you can read the file before it exists.
convert security_groups -> vpc_security_group_ids
|
hey @tamsky @mrwacky42 thanks a lot for this, I just dropped a few comments. |
| @@ -59,6 +59,7 @@ for i in $(ls .terraform/modules/*/Makefile); do i=$(dirname $i); make -C $i; do | |||
| ### Provision the cluster infrastructure | |||
|
|
|||
| ``` | |||
There was a problem hiding this comment.
Can we just remove the file from the repo and this will just work when running terraform apply? so no need to manual step?
There was a problem hiding this comment.
I think you're correct and it can be removed.
There was a problem hiding this comment.
I spoke too soon. It needs to stay.
Explanation is from
337e104
In Terraform 0.7.x, template file data sources do not support the
'provisioner' parameter. So instead, we must now use a null_resource to
get the discovery URL.And, unfortunately, depending on a null_resource does not mean that you
can read the file before it exists.
There was a problem hiding this comment.
Just tested this myself, So we just need to keep a (empty) file named "etcd_discovery_url.txt" in the repo so when running "terraform apply" terraform file() does not complain, then the null resource populates the file right before the template data source uses it.
| variable "organization" { default = "kubeform" } | ||
| variable "region" { default = "eu-west-1" } | ||
| variable "availability_zones" { default = "eu-west-1a,eu-west-1b,eu-west-1c" } | ||
| #variable "region" { default = "eu-west-1" } |
There was a problem hiding this comment.
Can we remove the comments?
| variable "region" { default = "eu-west-1" } | ||
| variable "availability_zones" { default = "eu-west-1a,eu-west-1b,eu-west-1c" } | ||
| #variable "region" { default = "eu-west-1" } | ||
| #variable "availability_zones" { default = "eu-west-1a,eu-west-1b,eu-west-1c" } |
There was a problem hiding this comment.
Why dont we keep "eu-west-1a,eu-west-1b,eu-west-1c" for the new definition? why only 2 elements?
There was a problem hiding this comment.
I should have used a tfvars file instead of doing it this way.
I thought us-west-2 had only 2 regions, (like us-west-1), but I just found out it has 3.
| command = "curl -s https://discovery.etcd.io/new?size=${var.masters} > ${var.etcd_discovery_url_file}" | ||
| } | ||
|
|
||
| # This will regenerate the discovery URL if the cluster size changes |
There was a problem hiding this comment.
is this meant to work on the fly? shouldn't we need to do something more sophisticated if the number of expected etcd masters increase as per https://coreos.com/etcd/docs/latest/etcd-live-cluster-reconfiguration.html?
There was a problem hiding this comment.
This would seem to be beyond the scope of this PR.
If there was a latent issue with the logic in the null_resource.etcd_discovery_url.command can you create an issue for it?
There was a problem hiding this comment.
There are comments in my commit message here that explain 337e104
Restated: Terraform generates the dependency graph before it creates the etcd_discovery_url.txt file. I think this will still barf on a fresh checkout without the url file in place.
There was a problem hiding this comment.
There is no latent issue. My comment here refers to the fact that you are retriggering the null resource when the size changes to generate a new token (emulating the current behaviour with "template_file") but not sure this is useful. As per the link above, that's not what you need when you modify the size of a running cluster. So I think the "triggers" here could be omitted as it does not really solve anything. It does not hurt either though
| @@ -0,0 +1,5 @@ | |||
| # these files should be symlinked and pulled out into a separate file from ../main.tf | |||
|
hey @tamsky let's create a different PR for DigitalOcean. |
|
I guess I don't know the proper way to squash a PR referencing a remote repo. What's the correct way? |
terraform apply(anddestroy) works mostly clean now.Later steps in the docs, like
ansible-playbookdoesn't apply cleanly, but I think that's beyond the scope of this PR.After Capgemini/tf_tls#45 lands,
we can fix the module references
s@github.com/tamsky@github.com/Capgemini@gbuilds from changes in #170