Skip to content

Full support for terraform-0.7.11 - #171

Closed
tamsky wants to merge 16 commits into
Capgemini:masterfrom
tamsky:terraform-0.7.x
Closed

Full support for terraform-0.7.11#171
tamsky wants to merge 16 commits into
Capgemini:masterfrom
tamsky:terraform-0.7.x

Conversation

@tamsky

@tamsky tamsky commented Nov 17, 2016

Copy link
Copy Markdown
Contributor

terraform apply (and destroy) works mostly clean now.

Later steps in the docs, like ansible-playbook doesn'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@g

builds from changes in #170

Sharif Nassar and others added 10 commits November 15, 2016 10:37
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
@enxebre

enxebre commented Nov 25, 2016

Copy link
Copy Markdown
Contributor

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

```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove the file from the repo and this will just work when running terraform apply? so no need to manual step?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're correct and it can be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread terraform/aws/public-cloud/main.tf Outdated
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" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the comments?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do.

Comment thread terraform/aws/public-cloud/main.tf Outdated
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" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dont we keep "eu-west-1a,eu-west-1b,eu-west-1c" for the new definition? why only 2 elements?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread terraform/aws/public-cloud/main.tf Outdated
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

@tamsky

tamsky commented Nov 29, 2016

Copy link
Copy Markdown
Contributor Author

@enxebre do you have an opinion on whether I should include @methril 's Digital Ocean terraform 0.7.x changes that he's offering in tamsky#1 ?

@enxebre

enxebre commented Dec 1, 2016

Copy link
Copy Markdown
Contributor

hey @tamsky let's create a different PR for DigitalOcean.
I just dropped a new comment on the etc discovery manual step but otherwise looks good to me. So Then If we can squash the git history to keep it cleaner I'm more than happy to merge. Thanks a lot for your contributions

@tamsky tamsky closed this Dec 1, 2016
@tamsky
tamsky deleted the terraform-0.7.x branch December 1, 2016 20:58
@tamsky

tamsky commented Dec 1, 2016

Copy link
Copy Markdown
Contributor Author

I guess I don't know the proper way to squash a PR referencing a remote repo.
I deleted my branch and pushed a new commit with the same branch name.

What's the correct way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants