{"id":339,"date":"2025-04-14T11:44:48","date_gmt":"2025-04-14T11:44:48","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2025\/04\/14\/11080294-getting-started-with-the-hostinger-terraform-provider\/"},"modified":"2025-04-14T11:44:48","modified_gmt":"2025-04-14T11:44:48","slug":"11080294-getting-started-with-the-hostinger-terraform-provider","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/11080294-getting-started-with-the-hostinger-terraform-provider\/","title":{"rendered":"Getting Started With the Hostinger Terraform Provider"},"content":{"rendered":"<p class=\"no-margin\">The Hostinger Terraform provider enables infrastructure management via Terraform&rsquo;s Infrastructure as Code (IaC) methodology. With this provider, you can automate the deployment and management of your Hostinger resources, such as VPS instances, DNS zones, and DNS records.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_d070eb142a\">Provider Setup<\/h2><p class=\"no-margin\">To get started, first define the Hostinger provider within your Terraform configuration:<\/p><pre><code>terraform {<br>  required_providers {<br>    hostinger = {<br>      source = \"hostinger\/hostinger\"<br>      version = \"0.1.3\"<br>    }<br>  }<br>}<br><br>provider \"hostinger\" {<br>  api_token = \"your_hostinger_api_token\"<br>}<\/code><\/pre><p class=\"no-margin\">Replace <code>your_hostinger_api_token<\/code> with your Hostinger API token, which you can obtain from your Hostinger account&rsquo;s <a href=\"https:\/\/hpanel.hostinger.com\/profile\/api\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">API settings<\/a>.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_81decc3749\">Example usage<\/h2><h3 id=\"h_ff5da495e6\">Creating a VPS instance<\/h3><p class=\"no-margin\">Here&rsquo;s how you can create a new VPS instance:<\/p><pre><code>resource \"hostinger_vps\" \"box\" {<br>  plan              = \"hostingercom-vps-kvm2-usd-1m\"<br>  data_center_id    = 13<br>  template_id       = 1002<br>  hostname          = \"web-01.example.com\"<br>  password          = \"SecureP@ssw0rd!\"<br>  post_install_script_id = hostinger_vps_post_install_script.nginx.id<br>  ssh_key_ids       = [hostinger_vps_ssh_key.inline_key.id]<br>}<\/code><\/pre><h3 id=\"h_219eb26d00\">Applying Configuration<\/h3><p class=\"no-margin\">After defining your resources, run:<\/p><pre><code>terraform init<br>terraform plan<br>terraform apply<\/code><\/pre><p class=\"no-margin\">Terraform will prompt you to confirm the changes. Once confirmed, Terraform will provision your Hostinger resources.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Explore further capabilities by checking the official documentation:<\/p><ul>\n<li>\n<p class=\"no-margin\"><a href=\"https:\/\/registry.terraform.io\/providers\/hostinger\/hostinger\/latest\/docs\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Hostinger Terraform Provider Documentation<\/a><\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">Integrating Terraform into your workflow allows efficient, reproducible management of your Hostinger infrastructure, enabling you to scale seamlessly<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to manage your Hostinger infrastructure efficiently using the Hostinger Terraform provider<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[295],"tags":[],"class_list":["post-339","post","type-post","status-publish","format-standard","hentry","category-api"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/11080294-getting-started-with-the-hostinger-terraform-provider\/","default":1}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=339"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/339\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}