Skip to content

shanalily/terraform-provider-acsengine

 
 

Repository files navigation

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

  • Usage - details about acs-engine Kubernetes cluster resource schema and how to configure a cluster
  • Data Source Usage - details about how to get data about an existing acs-engine Kubernetes cluster resource
  • Scaling clusters - shows how to scale a cluster's agent pool count
  • Upgrading clusters - shows how to upgrade a cluster's Kubernetes version
  • Terraform state - notes on how the state of the cluster is stored and resource creation
  • Developer guide - Information for contributors on setting up environment (and more)

General Requirements

  • Terraform 0.11.x
  • Go 1.10.x (to build the provider plugin)

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 [email protected]: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... [email protected]"
    }
  }

  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:

  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET
  • ARM_SUBSCRIPTION_ID
  • ARM_TENANT_ID
  • ARM_TEST_VAULT_ID
  • ARM_TEST_LOCATION
  • SSH_KEY_PUB

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 [email protected] with any additional questions or comments.

About

Terraform provider for ACS Engine Kubernetes cluster resources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 97.4%
  • Makefile 1.5%
  • Other 1.1%