Automatic releasing of Terraform modules (per-repo-module)
In this article I’m going to be covering how to use semantic-release to progamatically release new semantic versions when changes are made to a Terraform module stored in a GitHub repository.
This article does assume that you have a basic understanding of conventional commits, if not, I have an article on this here.
It’s also assumed that you have a repository configured already with some terraform in it that you are ready to release as a Terraform module. If you don’t.. You can use this demo repository as reference (https://github.com/tjtharrison/demo-terraform-module).
This article covers Terraform modules which are stored in a one-repository-per-module format, I’ll be following on from this article soon with another for automatic releasing of individual Terraform modules stored in a mono-repo of Terraform modules (more details at the end of this article).
Configuring the module repository
The first thing we will want to do in the repository, is create a package.json file with a few fields required for semantic-release:
{
"name": "terraform-demo-module",
"private": true,
"devDependencies": {
"@semantic-release/github": "^9.0.3",
"semantic-release": "^21.0.5"
},
"release": {…