{"id":15156490,"url":"https://github.com/clivern/terraform-provider-boilerplate","last_synced_at":"2026-02-14T01:37:09.059Z","repository":{"id":38154850,"uuid":"227639915","full_name":"Clivern/terraform-provider-boilerplate","owner":"Clivern","description":"🏄Terraform Provider Boilerplate.","archived":false,"fork":false,"pushed_at":"2025-08-10T13:23:20.000Z","size":114,"stargazers_count":17,"open_issues_count":5,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-30T22:44:53.684Z","etag":null,"topics":["clivern","infrastructure-as-code","infrastructure-management","terraform","terraform-module","terraform-modules","terraform-provider"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clivern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"clivern"}},"created_at":"2019-12-12T15:39:03.000Z","updated_at":"2022-09-28T16:09:40.000Z","dependencies_parsed_at":"2023-07-12T16:37:50.665Z","dependency_job_id":"b3c80425-7030-4fa7-8351-76c89f3a962e","html_url":"https://github.com/Clivern/terraform-provider-boilerplate","commit_stats":{"total_commits":44,"total_committers":3,"mean_commits":"14.666666666666666","dds":"0.31818181818181823","last_synced_commit":"10929aee0a4ac0dd9f4b16e0afe1732c3d89424a"},"previous_names":["clivern/terraform-provider-example"],"tags_count":7,"template":true,"template_full_name":null,"purl":"pkg:github/Clivern/terraform-provider-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clivern%2Fterraform-provider-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clivern%2Fterraform-provider-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clivern%2Fterraform-provider-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clivern%2Fterraform-provider-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clivern","download_url":"https://codeload.github.com/Clivern/terraform-provider-boilerplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clivern%2Fterraform-provider-boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273853341,"owners_count":25179826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clivern","infrastructure-as-code","infrastructure-management","terraform","terraform-module","terraform-modules","terraform-provider"],"created_at":"2024-09-26T19:22:10.097Z","updated_at":"2026-02-14T01:37:08.997Z","avatar_url":"https://github.com/Clivern.png","language":"Go","funding_links":["https://github.com/sponsors/clivern"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"terraform-provider-boilerplate Logo\" src=\"https://www.terraform.io/assets/images/og-image-8b3e4f7d.png\" width=\"150\" /\u003e\n    \u003ch3 align=\"center\"\u003eTerraform Provider Boilerplate.\u003c/h3\u003e\n    \u003cp align=\"center\"\u003e\n        \u003ca href=\"https://godoc.org/github.com/Clivern/terraform-provider-boilerplate\"\u003e\u003cimg src=\"https://godoc.org/github.com/Clivern/terraform-provider-boilerplate?status.svg\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://travis-ci.org/Clivern/terraform-provider-boilerplate\"\u003e\u003cimg src=\"https://travis-ci.org/Clivern/terraform-provider-boilerplate.svg?branch=master\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://github.com/Clivern/terraform-provider-boilerplate/releases\"\u003e\u003cimg src=\"https://img.shields.io/badge/Version-0.2.4-red.svg\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://goreportcard.com/report/github.com/Clivern/terraform-provider-boilerplate\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/Clivern/terraform-provider-boilerplate?v=0.2.2\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://github.com/Clivern/terraform-provider-boilerplate/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/LICENSE-MIT-orange.svg\"\u003e\u003c/a\u003e\n    \u003c/p\u003e\n\u003c/p\u003e\n\n\n## Documentation\n\nFirst we need to create a simple web service to do a CRUD operations.\n\n```golang\npackage main\n\nimport (\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n    \"os\"\n\n    \"github.com/gin-gonic/gin\"\n)\n\ntype Server struct {\n    Id     int    `json:\"id\"`\n    Image  string `json:\"image\"`\n    Name   string `json:\"name\"`\n    Size   string `json:\"size\"`\n    Region string `json:\"region\"`\n}\n\n// LoadFromJSON update object from json\nfunc (s *Server) LoadFromJSON(data []byte) (bool, error) {\n    err := json.Unmarshal(data, \u0026s)\n    if err != nil {\n        return false, err\n    }\n    return true, nil\n}\n\n// ConvertToJSON convert object to json\nfunc (s *Server) ConvertToJSON() (string, error) {\n    data, err := json.Marshal(\u0026s)\n    if err != nil {\n        return \"\", err\n    }\n    return string(data), nil\n}\n\nfunc Store(file, data string) (bool, error) {\n    f, err := os.Create(file)\n    if err != nil {\n        return false, err\n    }\n    _, err = f.WriteString(data)\n    if err != nil {\n        f.Close()\n        return false, err\n    }\n    err = f.Close()\n    if err != nil {\n        return false, err\n    }\n    return true, nil\n}\n\nfunc Retrieve(file string) string {\n    b, err := ioutil.ReadFile(file) // just pass the file name\n\n    if err != nil {\n        return \"\"\n    }\n\n    return string(b)\n}\n\nfunc main() {\n\n    gin.DisableConsoleColor()\n    gin.DefaultWriter = os.Stdout\n\n    r := gin.Default()\n\n    r.GET(\"/favicon.ico\", func(c *gin.Context) {\n        c.String(http.StatusNoContent, \"\")\n    })\n\n    r.GET(\"/server/:name\", func(c *gin.Context) {\n        data := Retrieve(\"db.txt\")\n\n        if data == \"\" {\n            c.JSON(http.StatusNotFound, gin.H{\n                \"status\": \"error\",\n                \"error\":  \"Server not found\",\n            })\n            return\n        }\n\n        server := \u0026Server{}\n        server.LoadFromJSON([]byte(data))\n\n        c.JSON(http.StatusOK, gin.H{\n            \"id\":     server.Id,\n            \"image\":  server.Image,\n            \"name\":   server.Name,\n            \"size\":   server.Size,\n            \"region\": server.Region,\n        })\n    })\n\n    r.POST(\"/server\", func(c *gin.Context) {\n        rawBody, err := c.GetRawData()\n\n        if err != nil {\n            c.JSON(http.StatusBadRequest, gin.H{\n                \"status\": \"error\",\n                \"error\":  \"Invalid request\",\n            })\n            return\n        }\n\n        server := \u0026Server{}\n        server.LoadFromJSON([]byte(rawBody))\n\n        server.Id = 1\n\n        data, _ := server.ConvertToJSON()\n\n        ok, err := Store(\"db.txt\", data)\n\n        if !ok || err != nil {\n            c.JSON(http.StatusInternalServerError, gin.H{\n                \"status\": \"error\",\n                \"error\":  \"Internal Server Error\",\n            })\n            return\n        }\n\n        c.JSON(http.StatusOK, gin.H{\n            \"id\":     server.Id,\n            \"image\":  server.Image,\n            \"name\":   server.Name,\n            \"size\":   server.Size,\n            \"region\": server.Region,\n        })\n    })\n\n    r.PUT(\"/server/:id\", func(c *gin.Context) {\n        rawBody, err := c.GetRawData()\n\n        if err != nil {\n            c.JSON(http.StatusBadRequest, gin.H{\n                \"status\": \"error\",\n                \"error\":  \"Invalid request\",\n            })\n            return\n        }\n\n        server := \u0026Server{}\n        server.LoadFromJSON([]byte(rawBody))\n\n        server.Id = 1\n\n        data, _ := server.ConvertToJSON()\n\n        ok, err := Store(\"db.txt\", data)\n\n        if !ok || err != nil {\n            c.JSON(http.StatusInternalServerError, gin.H{\n                \"status\": \"error\",\n                \"error\":  \"Internal Server Error\",\n            })\n            return\n        }\n\n        c.JSON(http.StatusOK, gin.H{\n            \"id\":     server.Id,\n            \"image\":  server.Image,\n            \"name\":   server.Name,\n            \"size\":   server.Size,\n            \"region\": server.Region,\n        })\n    })\n\n    r.DELETE(\"/server/:id\", func(c *gin.Context) {\n        Store(\"db.txt\", \"\")\n        c.Status(http.StatusNoContent)\n    })\n\n    r.GET(\"/image/:slug\", func(c *gin.Context) {\n        c.JSON(http.StatusOK, gin.H{\n            \"id\":            1,\n            \"slug\":          \"UBUNTU_18_04_64BIT\",\n            \"name\":          \"UBUNTU 18.04 64BIT\",\n            \"distribution\":  \"UBUNTU\",\n            \"private\":       false,\n            \"min_disk_size\": 20,\n        })\n    })\n\n    r.Run(fmt.Sprintf(\":%d\", 8080))\n}\n```\n\nRun this service on the background.\n\n```bash\n$ go run main.go\n```\n\nThen we can use our terraform provider to make changes to the web service resources.\n\n```bash\n$ git clone https://github.com/Clivern/terraform-provider-boilerplate.git\n\n# Build the provider\n$ make ARGS=\"terraform-provider-boilerplate\" build\n// OR\n$ go build -o terraform-provider-boilerplate\n\n# Initialize a working directory containing Terraform configuration files\n$ terraform init\n\n# Create an execution plan.\n$ terraform plan\n\n# Apply the changes required to reach the desired state of the configuration\n$ terraform apply\n\n# Revert changes\n$ terraform destroy\n```\n\n\n## General Rules\n\n- Terraform provider should always consume an independent client library or sdk which implements the core logic for communicating with the upstream. You should consider moving the `/sdk` to be a separate project.\n- Data sources are a special subset of resources which are read-only. They are resolved earlier than regular resources and can be used as part of Terraform's interpolation.\n\n\n## Versioning\n\nFor transparency into our release cycle and in striving to maintain backward compatibility, terraform-provider-boilerplate is maintained under the [Semantic Versioning guidelines](https://semver.org/) and release process is predictable and business-friendly.\n\nSee the [Releases section of our GitHub project](https://github.com/Clivern/terraform-provider-boilerplate/releases) for changelogs for each release version of terraform-provider-boilerplate. It contains summaries of the most noteworthy changes made in each release.\n\n\n## Bug tracker\n\nIf you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/Clivern/terraform-provider-boilerplate/issues\n\n\n## Security Issues\n\nIf you discover a security vulnerability within terraform-provider-boilerplate, please send an email to [hello@clivern.com](mailto:hello@clivern.com)\n\n\n## Contributing\n\nWe are an open source, community-driven project so please feel free to join us. see the [contributing guidelines](CONTRIBUTING.md) for more details.\n\n\n## License\n\n© 2019, Clivern. Released under [MIT License](https://opensource.org/licenses/mit-license.php).\n\n**terraform-provider-boilerplate** is authored and maintained by [@Clivern](http://github.com/Clivern).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclivern%2Fterraform-provider-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclivern%2Fterraform-provider-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclivern%2Fterraform-provider-boilerplate/lists"}