Jump to content

New Terraform Tutorials on Using and Creating Custom Terraform Providers


Recommended Posts

Terraform providers serve as bridges between the Terraform Core and target APIs. We have created a collection of tutorials to show you how to use and create custom Terraform providers. The example provider interacts with a fictional coffee-shop application, HashiCups. 

In the first tutorial, Perform CRUD Operations with Providers, you will use the Terraform HashiCups provider to create, read, update, and delete HashiCups resources. In the process, you will be able to see how the provider interacts with the HashiCups API by viewing the HashiCups logs. This tutorial also highlights new updates that Terraform 0.13 brings to providers, such as defining provider source in your configuration and where providers are locally stored.

The remaining tutorials walk you through re-creating the Terraform HashiCups provider using the Terraform Plugin SDK v2.

  1. In Setup and Implement Read, you will set up the Terraform provider boilerplate and define a Terraform data resource. This allows you to retrieve information from external APIs to use in your Terraform configuration. 
  2. In Add Authentication to a Provider, you will add authentication to the HashiCups provider. This allows you to access protected endpoints so you can create, update, and delete resources.
  3. In Implement Complex Read, you will add a data source from a protected endpoint. The data model is nested and contains many different data types. As a result, you will use flattening functions to convert the API’s JSON response into a `schema.Resource`.
  4. In Debug a Terraform Provider, you will add warning and error messages to the provider using `diag.Diagnostics`. This type is new to Terraform Plugin SDK v2 and aims to assist users through debugging.
  5. In Implement Create, you will add functionality to create a new resource to the provider.
  6. In Implement Update, you will add functionality to update a resource to the provider.
  7. In Implement Delete, you will add functionality to delete a resource to a provider.

By the end of this collection, you will be able to take these intuitions to create your own custom Terraform provider.

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...