Skip to content

canonical/terraform-provider-maas

Repository files navigation

Terraform Provider for MAAS

This repository contains the source code for the Terraform provider for MAAS, which allows you to manage MAAS (Metal as a Service) resources using Terraform.

Quick links

Additional resources:

Usage

Requirements

Usage

The provider is available from the Terraform Registry. The specified version will be found and installed automatically when specified in the required_providers section of your Terraform configuration file. An example using the latest version is shown below:

terraform {
  required_providers {
      maas = {
        source = "canonical/maas"
        version = "~>2.0"
      }
    }
  }

provider "maas" {
  api_version = "2.0"
  api_key     = "YOUR MAAS API KEY"
  api_url     = "http://<MAAS_SERVER>[:MAAS_PORT]/MAAS"
  installation_method = "snap"
}

# Your MAAS Terraform configuration here, for example:
resource "maas_fabric" "test_fabric" {
  name = "tf-fabric"
}

where the provider accepts the following config options:

  • api_key: MAAS API key.
  • api_url: URL for the MAAS API server (eg: http://127.0.0.1:5240/MAAS).
  • api_version: MAAS API version used. It is optional and it defaults to 2.0.
  • installation_method: MAAS installation method used. Optional, defaults to snap. Valid options: snap, and deb.

Build from source

If you want to build the provider from source and (optionally) install it:

  1. Clone the repository

  2. Enter the repository directory

  3. Build the provider with:

    make build
  4. (Optional): Install the freshly built provider with:

    make install

Contributing

If you're interested in contributing to the provider, please see the Contributing Guide for where to start.

Testing

The end to end tests run by the MAAS team's internal CI on a nightly basis against master, and on each PR.

⚠️ Repository ownership and provider name change

The Terraform Provider for MAAS repository now lives under the Canonical GitHub organisation with a new name github.com/canonical/terraform-provider-maas.

Ensure you are pointing at the new provider name inside your Terraform module(s), which is canonical/maas:

  1. Manually update the list of required providers in your Terraform module(s):

    terraform {
      required_providers {
        maas = {
    -     source  = "maas/maas"
    +     source  = "canonical/maas"
          version = "~>2.0"
        }
      }
    }
  2. Upgrade your provider dependencies to add the canonical/maas provider info:

    terraform init -upgrade
  3. Replace the provider reference in your state:

    terraform state replace-provider maas/maas canonical/maas
  4. Upgrade your provider dependencies to remove the maas/maas provider info:

    terraform init -upgrade

References:


License

See License.

About

Terraform MAAS provider

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages