This is the companion code to our How to Write a Custom Terraform Provider Automatically With OpenAPI article.
Learn more by checking out the article!
- Terraform 0.14.x
- Go 1.16 (to build the provider plugin)
- Go-Swagger v0.27.0+ (to generate the code)
Clone repository (here, using SSH):
$ git clone git@github.com:logicmonitor/automated-terraform-provider.git
Enter the provider directory and build the provider:
$ cd automated-terraform-provider/
$ make
The Makefile will then generate the code, build the binary, and copy it to the Terraform plugin directory.
The LogicMonitor Terraform Provider has two methods for setting required arguments: Environment Variables
export LM_API_ID=xyz
export LM_API_KEY=xyz
export LM_COMPANY=xyz
Provider Initialization
provider "logicmonitor" {
api_id = var.logicmonitor_api_id
api_key = var.logicmonitor_api_key
company = var.logicmonitor_company
}
Test cases can be found in the /automated-terraform-provider/Test
directory.