This provider enables you to send physical mail, driven by terraform, via https://mailform.io
Standing on the shoulders of giants enables us to yeet mail further.
⚠️ Orders cannot be updated/deleted (cancelled). Once created,no more modifications can be made due to API limitations. Deleted resources are simply removed from state.
The provider with use the environment variable MAILFORM_API_TOKEN
by default unless specified in the provider configuration.
terraform {
required_providers {
mailform = {
source = "circa10a/mailform"
}
}
}
provider "mailform" {
api_token = "XXX" // If not specified, will read MAILFORM_API_TOKEN environment variable
}
// Create PDF
resource "mailform_pdf" "example" {
header = "My Resumes"
content = "Some resume contents"
filename = "./test.pdf"
}
// Convert image to pdf for postcards
resource "mailform_pdf" "example" {
image_filename = "./test_image.jpg"
filename = "./test_image.pdf"
}
// Create mail order
resource "mailform_order" "example" {
pdf_file = mailform_pdf.example.filename
service = "USPS_PRIORITY"
to_name = "A name"
to_address_1 = "Address 1"
to_city = "Seattle"
to_state = "WA"
to_postcode = "00000"
to_country = "US"
from_name = "My name"
from_address_1 = "My Address 1"
from_city = "Dallas"
from_state = "TX"
from_postcode = "00000"
from_country = "US"
}
// Fetch order data
data "mailform_order" "example" {
id = mailform_order.example.id
}
output "order_info" {
value = data.mailform_order.example
}
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install
This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.
To add a new dependency github.com/author/dependency
to your Terraform provider:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.
Fill this in for each provider
If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).
To compile the provider, run go install
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
To generate or update documentation, run go generate
.