Skip to content

chandru-tkc/terraform-provider-nutanix

 
 

Repository files navigation

Terraform Nutanix Provider

Terraform provider plugin to integrate with Nutanix Enterprise Cloud

NOTE: terraform-provider-nutanix is currently tech preview as of 9 May 2018. See "Current Development Status" below.

Build, Quality Status

Go Report Card

Master Develop
Build Status Build Status

Community

Nutanix is taking an inclusive approach to developing this new feature and welcomes customer feedback. Please see our development project on GitHub (you're here!), comment on requirements, design, code, and/or feel free to join us on Slack. Instructions on commenting, contributing, and joining our community Slack channel are all located within our GitHub Readme.

For a slack invite, please contact [email protected] from your business email address, and we'll add you.

Current Development Status

Completed

  • Finished VM resource (VM resource and VM resource test.)
  • Finished subnet resource (Subnet resource and Subnet resource test.)
  • Finished Image resource (Image resource and image resource test.)
  • Finished VM data source (VM data source and VM data source test.)
  • Finished subnet data source (Subnet data source and Subnet data source test)
  • Finished Image data source (Image data source and image data source test.)
  • Cluster data source.
  • Clusters data source.
  • Virtual Machines data source.
  • Category keys resource.
  • Category values resource.
  • Network security rule data source.
  • Network security rules data source.
  • Subnets data source.
  • Images data source.
  • Volume group resource.
  • Volume group datasource.
  • Volume groups datasource.
  • Documentation for Resources.
  • Documentation for Datasources.

Currently working on:

  • Phase 2 scoping for bug cleanup and polish

Issues

  • See open issues on GitHub issues

Requirements

Provider Use

  • Terraform 0.11.11+
  • Nutanix Prism Central 5.6.0+
  • Note: Nutanix Community Edition will be supported, when an AOS 5.6 based version is released

Provider Development

  • Go 1.11+ (to build the provider plugin)

Provider Use

The Terraform Nutanix provider is designed to work with Nutanix Prism Central, such that you can manage one or more Prism Element clusters at scale. AOS/PC 5.6.0 or higher is required, as this Provider makes exclusive use of the v3 APIs

Example Usage

See the Examples folder for a handful of main.tf demos as well as some pre-compiled binaries.

We'll be refreshing these examples and binaries as we work through tech preview.

Long term, once this is upstream, no pre-compiled binaries will be needed, as terraform will automatically download on use.

Configuration Reference

The following keys can be used to configure the provider.

  • endpoint - (Required) IP address for the Nutanix Prism Element.
  • username - (Required) Username for Nutanix Prism Element. Could be local cluster auth (e.g. auth) or directory auth.
  • password - (Required) Password for the provided username.
  • port - (Optional) Port for the Nutanix Prism Element. Default port is 9440.
  • insecure - (Optional) Explicitly allow the provider to perform insecure SSL requests. If omitted, default value is false.

Resources

  • nutanix_virtual_machine
  • nutanix_image
  • nutanix_subnet
  • nutanix_category_key
  • nutanix_category_value

Data Sources

  • nutanix_virtual_machine
  • nutanix_virtual_machines
  • nutanix_image
  • nutanix_images
  • nutanix_subnet
  • nutanix_subnets
  • nutanix_clusters
  • nutanix_cluster

Additional Resources

We've got a handful of resources outside of this repository that will help users understand the interactions between terraform and Nutanix

  • YouTube _ Overview Video: _ Working with images:
  • Nutanix GitHub _ _ Private repo until code goes upstream
  • Jon’s GitHub _ _ Contains sample TF’s and PDFs from the youtube videos
  • Slack channel * User community slack channel is available on nutanix.slack.com. Email [email protected] to gain entry.

Roadmap

This provider will be released as Tech Preview at .NEXT New Orleans, and is linked into the HashiCorp community providers page, here:

We'll be working with HashiCorp as code stabilizes to upstream this properly, at which time we'll PR this entire plugin to the terraform providers org.

  • Complete upstream work with successful pull request
    • Note: Depending on external review timelines from HashiCorp and subsequent code change(s) as required
  • Add Volume Group resource and data source support * This is dependent on the VG v3 API, which is currently not GA (work in progress)
  • Investigate data protection workflows (likely scoped snapshots, but this may directly conflict with overall pets v cattle)
  • Investigate project as a resource and data source, for SSP integration
  • Investigate Calm once API constructs are available
  • Investigate AFS administration workflows
  • Investigate cluster administration APIs (think foundation, admin settings, etc) to do physical provisioning (think DC as Code)

Quick Install

Install Dependencies

  • Terraform

For developing or build from source

Golang

Install from source

Building from sources

  1. Follow Go installation instructions

  2. Make sure that $GOPATH variable is set (and $GOROOT if necessary)

  3. Clone the repository:

    git clone https://github.com/terraform-providers/terraform-provider-nutanix.git $GOPATH/src/github.com/terraform-providers/terraform-provider-nutanix
  4. Install golang/dep:

    go get -u github.com/golang/dep/cmd/dep
  5. Run tests:

    cd $GOPATH/src/github.com/terraform-providers/terraform-provider-nutanix
    make test #unit tests
    make testacc #acceptance tests
  6. Build the binary:

    cd $GOPATH/src/github.com/terraform-providers/terraform-provider-nutanix
    make cibuild #it will create a pkg folder with the binaries for all OS including linux, windows, macOS

Release it

  1. Install goreleaser tool:

    go get -v github.com/goreleaser/goreleaser
    cd $GOPATH/src/github.com/goreleaser/goreleaser
    go install

    Alternatively you can download a latest release from goreleaser Releases Page

  2. Clean up folder (builds) if exists

  3. Make sure that the repository state is clean:

    git status
  4. Tag the release:

    git tag v1.1.0
  5. Run goreleaser:

    cd (TODO: go dir)
    goreleaser --skip-publish v1.1.0
  6. Check builds inside (TODO: build dir) directory.

  7. Publish release tag to GitHub:

    git push origin v1.1.0

Install from package

Building/Developing Provider

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-nutanix

$ mkdir $GOPATH/src/github.com/terraform-providers && cd "$_" #if you already created it only change directory
$ git clone https://github.com/terraform-providers/terraform-provider-nutanix.git

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-nutanix
$ make deps
$ make build

This will create a binary file terraform-provider-nutanix you can copy to your terraform specific project.

Alternative build: with our demo

$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-nutanix
$ make deps
$ go build -o examples/terraform-provider-nutanix
$ cd examples
$ terraform init #to try out our demo

Packages

No packages published

Languages

  • Go 98.0%
  • Other 2.0%