terraform-provider-gardener

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL