Skip to content
Terraform Provider for Gardener
Go Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add github templates (#5) Sep 9, 2019
client change kubepath to take the raw bytes of the file (#11) Oct 24, 2019
examples upgrade terraform to V0.12.12 (#22) Oct 24, 2019
expand Schema change (#20) Oct 23, 2019
flatten Schema change (#20) Oct 23, 2019
provider
shoot Schema change (#20) Oct 23, 2019
validate
.gitignore Go mod migration (#18) Oct 9, 2019
CODEOWNERS Fix typos in imported packages (#10) Sep 27, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Sep 9, 2019
CONTRIBUTING.md Create CONTRIBUTING.md Sep 9, 2019
LICENSE Create LICENSE Sep 9, 2019
Makefile Prepare makefile for the prow job Aug 30, 2019
NOTICE.md added notice file Oct 24, 2019
OWNERS
README.md change kubepath to take the raw bytes of the file (#11) Oct 24, 2019
before-commit.sh Go mod migration (#18) Oct 9, 2019
go.mod upgrade terraform to V0.12.12 (#22) Oct 24, 2019
go.sum upgrade terraform to V0.12.12 (#22) Oct 24, 2019
main.go Read imp (#6) Sep 18, 2019

README.md

Terraform Provider for Gardener

Overview

The Terraform Provider for Gardener enables Terraform to provision Kubernetes clusters on chosen cloud providers using Gardener. Currently, it supports AWS, Azure, and GCP.

Prerequisites

  • Terraform 0.10+
  • Go 1.12 or higher
  • Gardener project with kubeconfig access and configured cloud provider secrets

Development

Perform the following steps to build the providers:

  1. Build the provider:

    go build -o terraform-provider-gardener
  2. Move the gardener provider binary into the terraform plugins folder:

    On MacOS:

    mv terraform-provider-gardener ~/.terraform.d/plugins/terraform-provider-gardener

    For other systems and further details, see this document.

Usage

Perform the following steps to use the provider:

  1. Go to the provider example folder:

    cd examples/<provider>
  2. Edit the main.tf file to provide the following parameters:

    • Path to the Gardener kubeconfig
    • Shoot specification

    NOTE: To obtain the gardener secret and kubeconfig go to the Gardener dashboard.

    provider "gardener" {
        kube_file          = "${file("<my-gardener-service-account-kubeconfig>")}"
    }
    resource "gardener_shoot" "<Name>" {
        metadata {
            name      = "<name-to-be-shown-in-gardener>"
            namespace = "<gardener-profile-namespace>"
    
        }
        spec {
            cloud {
            profile = "az"
            region  = "westeurope"
            seed    = "az-eu1"
    
            secret_binding_ref {
                name = "<secret_binding>"
            }
    
            azure {
                    networks {
                        vnet {
                            cidr = "10.250.0.0/16"
                        }
                        workers = "10.250.0.0/19"
                    }
    
                    worker {
                        name            = "cpu-worker"
                        machine_type    = "Standard_D2_v3"
                        auto_scaler_min = 3
                        auto_scaler_max = 3
                        max_surge       = 1
                        max_unavailable = 0
                        volume_type     = "standard"
                        volume_size     = "50Gi"
                    }
                }
            }
    
            kubernetes {
                version = "1.15.4"
            }
        }
    }
  3. Initialize Terraform:

    terraform init
  4. Plan the provisioning:

    terraform plan
  5. Deploy the cluster:

    terraform apply

Examples

See the examples to learn how to use Gardener to deploy clusters on AWS, GCP, and Azure.

You can’t perform that action at this time.