From 76c96c8d37b344990dd5199ed08562b9ecdd93d3 Mon Sep 17 00:00:00 2001 From: Bitor Tonixa Balenca Date: Tue, 19 Dec 2023 23:31:43 +0000 Subject: [PATCH] Initial commit --- README.md | 33 +++++++++++++++++++++++++++++++++ go.mod | 5 +++++ go.sum | 2 ++ main.go | 14 ++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 README.md create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go diff --git a/README.md b/README.md new file mode 100644 index 0000000..7cbdbf9 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Receipt terraform example provider + +## What? + +This is a terraform provider to serve as example. This will give an API to generate receipts based on a terraform +provider. + +## How? + +First step in this journey was to install go language. For that you can just follow something like [this](https://go.dev/doc/install). + +Next we need to init this as a [go module](https://go.dev/doc/tutorial/create-module) this is basically to help us to manage go dependencies. + +For this first step we ended with + +```sh +go mod init balhau.net/receita-provider +``` + +the output of this command was the creation of the `go.mod` file. + +Since the goal here is to build a terraform provider we must add the terraform libraries needed for that. This can be achieved with + +```sh +go get github.com/hashicorp/terraform-plugin-framework +``` + +After this command we ended with the following line +```sh +require github.com/hashicorp/terraform-plugin-framework v1.4.2 // indirect +``` + +added to our `go.mod` file. A `go.sum`, containing the checksum of the download dependencies, is also created diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..3ee7c4c --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module balhau.net/receita-provider + +go 1.20 + +require github.com/hashicorp/terraform-plugin-framework v1.4.2 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b2c4cfd --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/hashicorp/terraform-plugin-framework v1.4.2 h1:P7a7VP1GZbjc4rv921Xy5OckzhoiO3ig6SGxwelD2sI= +github.com/hashicorp/terraform-plugin-framework v1.4.2/go.mod h1:GWl3InPFZi2wVQmdVnINPKys09s9mLmTZr95/ngLnbY= diff --git a/main.go b/main.go new file mode 100644 index 0000000..827c926 --- /dev/null +++ b/main.go @@ -0,0 +1,14 @@ +package main + +import( + "github.com/hashicorp/terraform/plugin" + "github.com/hashicorp/terraform/provider" +) + +func main(){ + plugin.Serve(&plugin.ServeOpts{ + ProviderFunc: func() terraform.ResourceProvider { + return Provider() + } + }) +}