terraform-provider-webitel

command module
v0.0.0-...-21fbed0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

README

Terraform Provider Webitel (Terraform Plugin Framework)

This template repository is built on the Terraform Plugin Framework. The template repository built on the Terraform Plugin SDK can be found at terraform-provider-scaffolding. See Which SDK Should I Use? in the Terraform documentation for additional information.

Requirements

Using the provider

This is a small example of how to create contact. Please read the documentation for more information.

provider "webitel" {
  endpoint = "https://webitel.example.com/api"
  token    = "token"

  insecure = false

  retry {
    attempts = 3
    delay_ms = 2000
  }
}

resource "webitel_contact" "example" {
  name   = "foo"
  about  = "about foo bar"
  labels = ["label-foo", "label-bar"]

  variables = [
    {
      key   = "foo-key"
      value = "foo-value"
    }
  ]

  phones = [
    {
      code        = "1"
      destination = "123"
    }
  ]
}

Developing the Provider

If you're new to provider development, a good place to start is the Extending Terraform docs.

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

Terraform allows to use local provider builds by setting a dev_overrides block in a configuration file called .terraformrc. This block overrides all other configured installation methods. Terraform searches for the .terraformrc file in your home directory and applies any configuration settings you set.

  1. Find the GOBIN path where Go installs your binaries. Your path may vary depending on how your Go environment variables are configured.
$ go env GOBIN
/Users/<Username>/go/bin
  1. Create a new file called .terraformrc in your home directory (~), then add the dev_overrides block below. Change the <PATH> to the value returned from the go env GOBIN command above.
provider_installation {
  dev_overrides {
    "webitel/webitel" = "<PATH>" # this path is the directory where the binary is built
  }
          
  # For all other providers, install them directly from their origin provider
  # registries as normal. If you omit this, Terraform will _only_ use
  # the dev_overrides block, and so no other providers will be available.
  direct {}
}
  1. Use the go install command from the repository's root directory to compile the provider into a binary and install it in your GOBIN path. Terraform will use the binary you just built for every terraform plan/apply (it should print out a warning). No need to run terraform init.

In order to run the full suite of Acceptance tests, run make testacc.

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

make testacc

Documentation

Documentation is generated with tfplugindocs. Generated files are in docs/ and should not be updated manually. They are derived from:

  • Schema Description fields in the provider Go code.
  • examples/

Use go generate ./.. to update generated docs.

Releasing

Builds and releases are automated with GitHub Actions and GoReleaser.

Currently there are a few manual steps to this:

  1. Kick off the release:

    RELEASE_VERSION=v... \
    make release
    
  2. Publish release:

    The Action creates the release, but leaves it in "draft" state. Open it up in a browser and if all looks well, click the Auto-generate release notes button and mash the publish button.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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