Azure / terraform-provider-acsengine

Terraform provider for ACS Engine Kubernetes cluster resources.
MIT License
13 stars 9 forks source link

ACS Engine Kubernetes Terraform Provider

Overview

The Azure Container Service Engine Kubernetes Terraform Provider allows you to create and manage ACS Engine Kubernetes clusters with a simple Terraform configuration. Other container orchestrators are not supported.

This started out as a fork of terraform-providers/terraform-provider-azurerm so a lot of code is inspired-by-slash-taken-from that repo.

User Guides

General Requirements

Building The Provider

Clone repository to: $GOPATH/src/github.com/Azure/terraform-provider-acsengine

$ mkdir -p $GOPATH/src/github.com/Azure; cd $GOPATH/src/github.com/Azure
$ git clone git@github.com:Azure/terraform-provider-acsengine

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/Azure/terraform-provider-acsengine
$ make build

Using the provider

# Configure the Microsoft ACS Engine Provider
provider "acsengine" {
  # NOTE: Environment Variables can also be used for Service Principal authentication
  # Terraform also supports authenticating via the Azure CLI too.
  # see here for more info: http://terraform.io/docs/providers/azurerm/index.html

  # subscription_id = "..."
  # client_id       = "..."
  # client_secret   = "..."
  # tenant_id       = "..."
}

# Create a Kubernetes cluster
resource "acsengine_kubernetes_cluster" "test" {
  name               = "acctest"
  resource_group     = "acctestRG"
  location           = "southcentralus"
  kubernetes_version = "1.10.4"

  master_profile {
    count           = 1
    dns_name_prefix = "acctestmaster"
  }

  agent_pool_profiles {
    name    = "agentpool1"
    count   = 2
    vm_size = "Standard_D2_v2"
  }

  linux_profile {
    admin_username = "acctestuser"
    ssh {
      key_data = "ssh-rsa AAAAB3NzaC... terraform@demo.tld"
    }
  }

  service_principal {
    client_id     = ""
    vault_id      = ""
    secret_name   = "spsecret"
  }

  tags {
    Environment = "Production"
  }
}

Further usage documentation can be found in the docs directory. This also contains an examples directory for more specific cases.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.10+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
...
$ $GOPATH/bin/terraform-provider-acsengine
...

The following ENV variables must be set in your shell prior to running tests:

In order to run the provider unit tests, you can simply run make test.

$ make test

In order to run the full suite of Acceptance tests, run make testacc. This will take some time.

Note: Acceptance tests create real resources, and often cost money to run.

$ make testacc

Contributing

This project welcomes contributions and suggestions. Please follow the guidelines on our contributing page if you would like to help out.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.