Published on: January 24, 2024
3 min read
Follow this tutorial to learn how to use AI-powered code creation to manage your infrastructure with Terraform.
Terraform is an industry-standard for infrastructure orchestration. It can, however, be daunting and time-consuming to learn how to create infrastructure resources, especially when using Terraform providers you are unfamiliar with. That is where GitLab Duo Code Suggestions and AI-powered code creation comes in.
GitLab Duo Code Suggestions accelerates your coding in up to 15 supported programming languages, including infrastructure as code (IaC) using Terraform.
By combining IaC with Terraform, infrastructure teams can adopt new Terraform providers/modules quickly and move changes to production faster. The combination also reduces the onboarding time for new users of Terraform or developers who are new to a code base by maintaining the context of the code base and dependencies in its suggestions. Instead of spending hours reading through documentation, you only need to review the given suggestions and update as necessary.
In this post, you will learn how to set up GitLab Duo Code Suggestions for Terraform.
Follow these 6 steps to get started:
Once you have all the prerequisites in place, all you need to do next is create a Terraform file ending with .tf
and prompt GitLab Duo with comments describing what you want. Suggestions will be displayed while maintaining context. Even when no prompt is provided, GitLab Duo will suggest other Terraform resources you might be interested in based on the current context in your plans.
Let's see this in action with GitLab Duo helping with a Terraform plan for provisioning a load balancer with four instances and other necessary resources on the Google Cloud Platform.
Try Code Suggestions today and accelerate your software development. Code Suggestions is also available for self-managed GitLab (needs to be enabled by an administrator). Code Suggestions uses best-in-class large language models, and non-public customer data is never used as training data.