https://github.com/logicmonitor/automated-terraform-provider
This repo accompanies our blogpost titled "How to Write a Custom Terraform Provider Automatically with OpenAPI"
https://github.com/logicmonitor/automated-terraform-provider
Last synced: 8 months ago
JSON representation
This repo accompanies our blogpost titled "How to Write a Custom Terraform Provider Automatically with OpenAPI"
- Host: GitHub
- URL: https://github.com/logicmonitor/automated-terraform-provider
- Owner: logicmonitor
- Created: 2022-04-08T16:37:23.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-20T23:10:13.000Z (about 4 years ago)
- Last Synced: 2025-04-13T21:07:51.941Z (about 1 year ago)
- Language: Groovy
- Size: 3.73 MB
- Stars: 15
- Watchers: 7
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Automatically Writing a Terraform Provider for LogicMonitor

This is the companion code to our [**How to Write a Custom Terraform Provider Automatically With OpenAPI**](http://logicmonitor.com/blog/how-to-write-a-custom-terraform-provider-automatically-with-openapi) article.
Learn more by checking out the article!
## Requirements
- [Terraform](https://www.terraform.io/downloads.html) 0.14.x
- [Go](https://golang.org/doc/install) 1.16 (to build the provider plugin)
- [Go-Swagger](https://goswagger.io/install.html) v0.27.0+ (to generate the code)
## Building the Provider
Clone repository (here, using SSH):
```sh
$ git clone git@github.com:logicmonitor/automated-terraform-provider.git
```
Enter the provider directory and build the provider:
```sh
$ cd automated-terraform-provider/
$ make
```
The Makefile will then generate the code, build the binary, and copy it to the Terraform plugin directory.
## Using the provider
The LogicMonitor Terraform Provider has two methods for setting required arguments:
Environment Variables
```sh
export LM_API_ID=xyz
export LM_API_KEY=xyz
export LM_COMPANY=xyz
```
Provider Initialization
```sh
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.