Skip to content

Commit bbe295a

Browse files
committed
Add Terraform v0.11.x support and migration docs
* Add explicit "providers" section to modules for Terraform v0.11.x * Retain support for Terraform v0.10.4+ * Add migration guide from Terraform v0.10.x to v0.11.x for those managing existing clusters (action required!)
1 parent d8db296 commit bbe295a

File tree

8 files changed

+226
-12
lines changed

8 files changed

+226
-12
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Notable changes between versions.
44

55
## Latest
66

7+
* Add Terraform v0.11.x support
8+
* Add explicit "providers" section to modules for Terraform v0.11.x
9+
* Retain support for Terraform v0.10.4+
10+
* Add [migration guide](https://github.com/poseidon/typhoon/blob/master/docs/topics/maintenance.md) from Terraform v0.10.x to v0.11.x (action required!)
711
* Update etcd from 3.2.13 to 3.2.14
812
* Update kube-dns from v1.14.7 to v1.14.8
913
* Use separate service account for kube-dns

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ Define a Kubernetes cluster by using the Terraform module for your chosen platfo
4444
```tf
4545
module "google-cloud-yavin" {
4646
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes"
47+
48+
providers = {
49+
google = "google.default"
50+
local = "local.default"
51+
null = "null.default"
52+
template = "template.default"
53+
tls = "tls.default"
54+
}
4755
4856
# Google Cloud
4957
region = "us-central1"

docs/aws.md

+34-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Controllers and workers are provisioned to run a `kubelet`. A one-time [bootkube
1010

1111
* AWS Account and IAM credentials
1212
* AWS Route53 DNS Zone (registered Domain Name or delegated subdomain)
13-
* Terraform v0.10.x and [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) installed locally
13+
* Terraform v0.11.x and [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) installed locally
1414

1515
## Terraform Setup
1616

17-
Install [Terraform](https://www.terraform.io/downloads.html) v0.10.x on your system.
17+
Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your system.
1818

1919
```sh
2020
$ terraform version
21-
Terraform v0.10.7
21+
Terraform v0.11.1
2222
```
2323

2424
Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system.
@@ -57,9 +57,32 @@ Configure the AWS provider to use your access key credentials in a `providers.tf
5757

5858
```tf
5959
provider "aws" {
60+
version = "~> 1.5.0"
61+
alias = "default"
62+
6063
region = "eu-central-1"
6164
shared_credentials_file = "/home/user/.config/aws/credentials"
6265
}
66+
67+
provider "local" {
68+
version = "~> 1.0"
69+
alias = "default"
70+
}
71+
72+
provider "null" {
73+
version = "~> 1.0"
74+
alias = "default"
75+
}
76+
77+
provider "template" {
78+
version = "~> 1.0"
79+
alias = "default"
80+
}
81+
82+
provider "tls" {
83+
version = "~> 1.0"
84+
alias = "default"
85+
}
6386
```
6487

6588
Additional configuration options are described in the `aws` provider [docs](https://www.terraform.io/docs/providers/aws/).
@@ -75,6 +98,14 @@ Define a Kubernetes cluster using the module `aws/container-linux/kubernetes`.
7598
module "aws-tempest" {
7699
source = "git::https://github.com/poseidon/typhoon//aws/container-linux/kubernetes"
77100
101+
providers = {
102+
aws = "aws.default"
103+
local = "local.default"
104+
null = "null.default"
105+
template = "template.default"
106+
tls = "tls.default"
107+
}
108+
78109
cluster_name = "tempest"
79110
80111
# AWS

docs/bare-metal.md

+30-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Controllers are provisioned as etcd peers and run `etcd-member` (etcd3) and `kub
1212
* PXE-enabled [network boot](https://coreos.com/matchbox/docs/latest/network-setup.html) environment
1313
* Matchbox v0.6+ deployment with API enabled
1414
* Matchbox credentials `client.crt`, `client.key`, `ca.crt`
15-
* Terraform v0.10.x and [terraform-provider-matchbox](https://github.com/coreos/terraform-provider-matchbox) installed locally
15+
* Terraform v0.11.x and [terraform-provider-matchbox](https://github.com/coreos/terraform-provider-matchbox) installed locally
1616

1717
## Machines
1818

@@ -109,11 +109,11 @@ Read about the [many ways](https://coreos.com/matchbox/docs/latest/network-setup
109109

110110
## Terraform Setup
111111

112-
Install [Terraform](https://www.terraform.io/downloads.html) v0.10.x on your system.
112+
Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your system.
113113

114114
```sh
115115
$ terraform version
116-
Terraform v0.10.7
116+
Terraform v0.11.1
117117
```
118118

119119
Add the [terraform-provider-matchbox](https://github.com/coreos/terraform-provider-matchbox) plugin binary for your system.
@@ -149,6 +149,26 @@ provider "matchbox" {
149149
client_key = "${file("~/.config/matchbox/client.key")}"
150150
ca = "${file("~/.config/matchbox/ca.crt")}"
151151
}
152+
153+
provider "local" {
154+
version = "~> 1.0"
155+
alias = "default"
156+
}
157+
158+
provider "null" {
159+
version = "~> 1.0"
160+
alias = "default"
161+
}
162+
163+
provider "template" {
164+
version = "~> 1.0"
165+
alias = "default"
166+
}
167+
168+
provider "tls" {
169+
version = "~> 1.0"
170+
alias = "default"
171+
}
152172
```
153173

154174
## Cluster
@@ -159,6 +179,13 @@ Define a Kubernetes cluster using the module `bare-metal/container-linux/kuberne
159179
module "bare-metal-mercury" {
160180
source = "git::https://github.com/poseidon/typhoon//bare-metal/container-linux/kubernetes"
161181
182+
providers = {
183+
local = "local.default"
184+
null = "null.default"
185+
template = "template.default"
186+
tls = "tls.default"
187+
}
188+
162189
# install
163190
matchbox_http_endpoint = "http://matchbox.example.com"
164191
container_linux_channel = "stable"

docs/digital-ocean.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Controllers and workers are provisioned to run a `kubelet`. A one-time [bootkube
1010

1111
* Digital Ocean Account and Token
1212
* Digital Ocean Domain (registered Domain Name or delegated subdomain)
13-
* Terraform v0.10.x and [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) installed locally
13+
* Terraform v0.11.x and [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) installed locally
1414

1515
## Terraform Setup
1616

17-
Install [Terraform](https://www.terraform.io/downloads.html) v0.10.x on your system.
17+
Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your system.
1818

1919
```sh
2020
$ terraform version
21-
Terraform v0.10.7
21+
Terraform v0.11.1
2222
```
2323

2424
Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system.
@@ -58,7 +58,29 @@ Configure the DigitalOcean provider to use your token in a `providers.tf` file.
5858

5959
```tf
6060
provider "digitalocean" {
61+
version = "0.1.2"
6162
token = "${chomp(file("~/.config/digital-ocean/token"))}"
63+
alias = "default"
64+
}
65+
66+
provider "local" {
67+
version = "~> 1.0"
68+
alias = "default"
69+
}
70+
71+
provider "null" {
72+
version = "~> 1.0"
73+
alias = "default"
74+
}
75+
76+
provider "template" {
77+
version = "~> 1.0"
78+
alias = "default"
79+
}
80+
81+
provider "tls" {
82+
version = "~> 1.0"
83+
alias = "default"
6284
}
6385
```
6486

@@ -69,6 +91,14 @@ Define a Kubernetes cluster using the module `digital-ocean/container-linux/kube
6991
```tf
7092
module "digital-ocean-nemo" {
7193
source = "git::https://github.com/poseidon/typhoon//digital-ocean/container-linux/kubernetes"
94+
95+
providers = {
96+
digitalocean = "digitalocean.default"
97+
local = "local.default"
98+
null = "null.default"
99+
template = "template.default"
100+
tls = "tls.default"
101+
}
72102
73103
region = "nyc3"
74104
dns_zone = "digital-ocean.example.com"

docs/google-cloud.md

+34-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Controllers and workers are provisioned to run a `kubelet`. A one-time [bootkube
1010

1111
* Google Cloud Account and Service Account
1212
* Google Cloud DNS Zone (registered Domain Name or delegated subdomain)
13-
* Terraform v0.10.x and [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) installed locally
13+
* Terraform v0.11.x and [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) installed locally
1414

1515
## Terraform Setup
1616

17-
Install [Terraform](https://www.terraform.io/downloads.html) v0.10.x on your system.
17+
Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your system.
1818

1919
```sh
2020
$ terraform version
21-
Terraform v0.10.7
21+
Terraform v0.11.1
2222
```
2323

2424
Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system.
@@ -57,10 +57,33 @@ Configure the Google Cloud provider to use your service account key, project-id,
5757

5858
```tf
5959
provider "google" {
60+
version = "1.2"
61+
alias = "default"
62+
6063
credentials = "${file("~/.config/google-cloud/terraform.json")}"
6164
project = "project-id"
6265
region = "us-central1"
6366
}
67+
68+
provider "local" {
69+
version = "~> 1.0"
70+
alias = "default"
71+
}
72+
73+
provider "null" {
74+
version = "~> 1.0"
75+
alias = "default"
76+
}
77+
78+
provider "template" {
79+
version = "~> 1.0"
80+
alias = "default"
81+
}
82+
83+
provider "tls" {
84+
version = "~> 1.0"
85+
alias = "default"
86+
}
6487
```
6588

6689
Additional configuration options are described in the `google` provider [docs](https://www.terraform.io/docs/providers/google/index.html).
@@ -75,6 +98,14 @@ Define a Kubernetes cluster using the module `google-cloud/container-linux/kuber
7598
```tf
7699
module "google-cloud-yavin" {
77100
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes"
101+
102+
providers = {
103+
google = "google.default"
104+
local = "local.default"
105+
null = "null.default"
106+
template = "template.default"
107+
tls = "tls.default"
108+
}
78109
79110
# Google Cloud
80111
region = "us-central1"

docs/index.md

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ Define a Kubernetes cluster by using the Terraform module for your chosen platfo
4444
```tf
4545
module "google-cloud-yavin" {
4646
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes"
47+
48+
providers = {
49+
google = "google.default"
50+
local = "local.default"
51+
null = "null.default"
52+
template = "template.default"
53+
tls = "tls.default"
54+
}
4755
4856
# Google Cloud
4957
region = "us-central1"

docs/topics/maintenance.md

+75
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,78 @@ Typhoon supports multi-controller clusters, so it is possible to upgrade a clust
127127
!!! warning
128128
Typhoon does not support or document node replacement as an upgrade strategy. It limits Typhoon's ability to make infrastructure and architectural changes between tagged releases.
129129

130+
## Terraform v0.11.x
131+
132+
Terraform v0.10.x to v0.11.x introduced breaking changes in the provider and module inheritance relationship that you MUST be aware of when upgrading to the v0.11.x `terraform` binary. Terraform now allows multiple named (i.e. aliased) copies of a provider to exist (e.g `aws.default`, `aws.somename`). Terraform now also requires providers be explicitly passed to modules in order to satisfy module version contraints (which Typhoon modules define). Full details can be found in [typhoon#77](https://github.com/poseidon/typhoon/issues/77) and [hashicorp#16824](https://github.com/hashicorp/terraform/issues/16824).
133+
134+
In particular, after upgrading to the v0.11.x `terraform` binary, you'll notice:
135+
136+
* `terraform plan` does not succeed and prompts for variables when it didn't before
137+
* `terraform plan` does not succeed and mentions "provider configuration block is required for all operations"
138+
* `terraform apply` fails when you comment or remove a module usage in order to delete a cluster
139+
140+
### New users
141+
142+
New users can start with Terraform v0.11.x and follow the Typhoon docs without issue.
143+
144+
### Existing
145+
146+
Users who used modules to create clusters with Terraform v0.10.x and still manage those clusters via Terraform must explicitly add each provider used in `provider.tf`:
147+
148+
```
149+
provider "local" {
150+
version = "~> 1.0"
151+
alias = "default"
152+
}
153+
154+
provider "null" {
155+
version = "~> 1.0"
156+
alias = "default"
157+
}
158+
159+
provider "template" {
160+
version = "~> 1.0"
161+
alias = "default"
162+
}
163+
164+
provider "tls" {
165+
version = "~> 1.0"
166+
alias = "default"
167+
}
168+
```
169+
170+
Modify the `google`, `aws`, or `digitalocean` provider section to specify an explicit `alias` name.
171+
172+
```
173+
provider "digitalocean" {
174+
version = "0.1.2"
175+
token = "${chomp(file("~/.config/digital-ocean/token"))}"
176+
alias = "default"
177+
}
178+
```
179+
180+
!!! note
181+
In these examples, we've chosen to name each provider "default", though the point of the Terraform changes is that other possibilities are possible.
182+
183+
Edit each instance (i.e. usage) of a module and explicitly pass the providers.
184+
185+
```
186+
module "aws-cluster" {
187+
source = "git::https://github.com/poseidon/typhoon//aws/container-linux/kubernetes"
188+
189+
providers = {
190+
aws = "aws.default"
191+
local = "local.default"
192+
null = "null.default"
193+
template = "template.default"
194+
tls = "tls.default"
195+
}
196+
197+
cluster_name = "somename"
198+
```
199+
200+
Re-run `terraform plan`. Plan will claim there are no changes to apply. Run `terraform apply` anyway as this will update Terraform state to be aware of the explicit provider versions.
201+
202+
### Verify
203+
204+
You should now be able to run `terraform plan` without errors. When you choose, you may comment or delete a module from Terraform configs and `terraform apply` should destroy the cluster correctly.

0 commit comments

Comments
 (0)