This commit is contained in:
Balhau 2024-07-05 13:18:10 +01:00
parent 085d1377de
commit fc1ab1f2cb
2 changed files with 19 additions and 14 deletions

View file

@ -3,40 +3,40 @@ arch?=darwin_amd64
provider_directory=~/.terraform.d/plugins/terraform.local/balhau/receita/1.0.0/$(arch)/
.PHONY: help
help: ## Show this help.
@sed -ne 's/^\([^[:space:]]*\):.*##/\1:\t/p' $(MAKEFILE_LIST) | column -t -s $$'\t'
help: ## Show this help.
@sed -ne 's/^\([^[:space:]]*\):.*##/\1:\t/p' $(MAKEFILE_LIST) | column -t -s $$
.PHONY: clean-bin
clean-bin: ## Clean all the generated binaries
clean-bin: ## Clean all the generated binaries
rm -rf bin
.PHONY: clean-terraform-state
clean-terraform-state: ## Clean all the terraform state generated by terraform-init/terraform-apply
clean-terraform-state: ## Clean all the terraform state generated by terraform-init/terraform-apply
rm -rf example/.terraform example/terraform.tfstate.backup example/.terraform.lock.hcl example/terraform.tfstate
.PHONY: clean
clean: clean-bin clean-terraform-state ## Clean all the generated resources
clean: clean-bin clean-terraform-state ## Clean all the generated resources
.PHONY: terraform-init
terraform-init: clean-terraform-state ## Execute terraform-init on example terraform directory
terraform-init: clean-terraform-state ## Execute terraform-init on example terraform directory
cd example; terraform init
.PHONY: terraform-apply
terraform-apply: ## Execute terraform-apply on example directory
cd example; terraform apply
terraform-apply: ## Execute terraform-apply on example directory
cd example; terraform apply -auto-approve
.PHONY: build
build: ## Build binaries, both the backed dummy server as the terraform provider binary
build: ## Build binaries, both the backed dummy server as the terraform provider binary
mkdir -p bin
go build -o bin/terraform-provider-receita
go build -o bin/backend api/backend.go
.PHONY: install-provider
install-provider: ## Install provider in the terraform plugin directory
install-provider: ## Install provider in the terraform plugin directory
mkdir -p $(provider_directory)
cp bin/terraform-provider-receita $(provider_directory)
.PHONY: run-backend
run-backend: build ## Start the backend web server
run-backend: build ## Start the backend web server
bin/backend

View file

@ -10,13 +10,18 @@ provider "receita" {
endpoint = "http://localhost:9999"
}
resource "receita_receita" "receita_one" {
resource "receita_receita" "bola_carne" {
name = "Bola de carne"
#name = "Batata frita"
author = "Maria Bacalhau"
}
resource "receita_receita" "receita_two" {
name = "Bacalhau com Todos"
resource "receita_receita" "bacalhau_todos" {
name = "Bacalhau com todos"
author = "Antonio Mariscada"
}
resource "receita_receita" "pato_bravo" {
name = "Pato bravo"
author = "Jose Pato"
}