Initial commit
This commit is contained in:
commit
76c96c8d37
4 changed files with 54 additions and 0 deletions
33
README.md
Normal file
33
README.md
Normal file
|
@ -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
|
5
go.mod
Normal file
5
go.mod
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module balhau.net/receita-provider
|
||||||
|
|
||||||
|
go 1.20
|
||||||
|
|
||||||
|
require github.com/hashicorp/terraform-plugin-framework v1.4.2 // indirect
|
2
go.sum
Normal file
2
go.sum
Normal file
|
@ -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=
|
14
main.go
Normal file
14
main.go
Normal file
|
@ -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()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in a new issue