Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Remove provider aliases from go templates #617

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.0"

required_providers {
aws = "2.48.0"
ct = "0.5.0"
template = "~> 2.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ terraform {

required_providers {
ct = "= 0.5.0"
local = "~> 1.2"
template = "~> 2.1"
tls = "~> 2.0"
packet = "~> 2.7.3"
}
}
12 changes: 10 additions & 2 deletions pkg/assets/generated_assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions pkg/platform/aws/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ var terraformConfigTmpl = `
module "aws-{{.Config.ClusterName}}" {
source = "../lokomotive-kubernetes/aws/flatcar-linux/kubernetes"

providers = {
aws = aws.default
local = local.default
null = null.default
template = template.default
tls = tls.default
}

cluster_name = "{{.Config.ClusterName}}"
tags = {{.Tags}}
dns_zone = "{{.Config.DNSZone}}"
Expand Down Expand Up @@ -109,10 +101,6 @@ module "aws-{{.Config.ClusterName}}" {
module "worker-pool-{{ $index }}" {
source = "../lokomotive-kubernetes/aws/flatcar-linux/kubernetes/workers"

providers = {
aws = aws.default
}

vpc_id = module.aws-{{ $.Config.ClusterName }}.vpc_id
subnet_ids = flatten([module.aws-{{ $.Config.ClusterName }}.subnet_ids])
security_groups = module.aws-{{ $.Config.ClusterName }}.worker_security_groups
Expand Down Expand Up @@ -183,7 +171,6 @@ module "worker-pool-{{ $index }}" {

provider "aws" {
version = "2.48.0"
alias = "default"

region = "{{.Config.Region}}"
{{- if .Config.CredsPath }}
Expand All @@ -197,22 +184,18 @@ provider "ct" {

provider "local" {
version = "1.4.0"
alias = "default"
}

provider "null" {
version = "~> 2.1"
alias = "default"
}

provider "template" {
version = "~> 2.1"
alias = "default"
}

provider "tls" {
version = "~> 2.0"
alias = "default"
}

# Stub output, which indicates, that Terraform run at least once.
Expand Down
11 changes: 0 additions & 11 deletions pkg/platform/baremetal/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ var terraformConfigTmpl = `
module "bare-metal-{{.ClusterName}}" {
source = "../lokomotive-kubernetes/bare-metal/flatcar-linux/kubernetes"

providers = {
local = local.default
null = null.default
template = template.default
tls = tls.default
}

# bare-metal
cluster_name = "{{.ClusterName}}"
matchbox_http_endpoint = "{{.MatchboxHTTPEndpoint}}"
Expand Down Expand Up @@ -79,22 +72,18 @@ provider "ct" {

provider "local" {
version = "1.4.0"
alias = "default"
}

provider "null" {
version = "~> 2.1"
alias = "default"
}

provider "template" {
version = "~> 2.1"
alias = "default"
}

provider "tls" {
version = "~> 2.0"
alias = "default"
}

# Stub output, which indicates, that Terraform run at least once.
Expand Down
27 changes: 0 additions & 27 deletions pkg/platform/packet/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ var terraformConfigTmpl = `
module "packet-{{.Config.ClusterName}}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes"

providers = {
local = local.default
null = null.default
template = template.default
tls = tls.default
packet = packet.default
}

dns_zone = "{{.Config.DNS.Zone}}"

ssh_keys = {{.SSHPublicKeys}}
Expand Down Expand Up @@ -124,13 +116,6 @@ EOF
module "worker-{{ $pool.Name }}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers"

providers = {
local = local.default
template = template.default
tls = tls.default
packet = packet.default
}

dns_zone = "{{$.Config.DNS.Zone}}"

ssh_keys = {{$.SSHPublicKeys}}
Expand Down Expand Up @@ -236,12 +221,6 @@ EOF
module "dns" {
source = "../lokomotive-kubernetes/dns/{{.Config.DNS.Provider}}"

{{ if eq .Config.DNS.Provider "route53" -}}
providers = {
aws = aws.default
}

{{ end -}}
cluster_name = "{{ .Config.ClusterName }}"
controllers_public_ipv4 = module.packet-{{.Config.ClusterName}}.controllers_public_ipv4
controllers_private_ipv4 = module.packet-{{.Config.ClusterName}}.controllers_private_ipv4
Expand All @@ -258,7 +237,6 @@ output "dns_entries" {
{{- if eq .Config.DNS.Provider "route53" }}
provider "aws" {
version = "2.48.0"
alias = "default"
# The Route 53 service doesn't need a specific region to operate, however
# the AWS Terraform provider needs it and the documentation suggests to use
# "us-east-1": https://docs.aws.amazon.com/general/latest/gr/r53.html.
Expand All @@ -272,27 +250,22 @@ provider "ct" {

provider "local" {
version = "1.4.0"
alias = "default"
}

provider "null" {
version = "~> 2.1"
alias = "default"
}

provider "template" {
version = "~> 2.1"
alias = "default"
}

provider "tls" {
version = "~> 2.0"
alias = "default"
}

provider "packet" {
version = "~> 2.7.3"
alias = "default"

{{- if .Config.AuthToken }}
auth_token = "{{.Config.AuthToken}}"
Expand Down