This is a Terraform provider for Edgio API. This provider is based on Terraform Plugin Framework, for more information you can check the Terraform Plugin Framework
terraform {
required_providers {
edgio = {
source = "Edgio/edgio"
version = "0.1.0"
}
}
}
provider "edgio" {
client_id = "your client id"
client_secret = "your client secret"
}
To obtain client_id
and client_secret
, you need to create an API client on the Edgio platform and you must set necessary permissions for the client. Currently these scopes are required for the provider to work:
app.accounts
app.config
For more information how to create an API client, check the Edgio API documentation
There are examples in the examples
directory. To run an example, navigate to the example directory and run terraform init
and terraform apply
.
For more information check Readme
in the examples directory.
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install
To enable terraform debugging you need Dlv:
go get github.com/go-delve/delve/cmd/dlv
Before running Dlv, you need to build the provider with the following command:
go build -gcflags "all=-N -l" -o terraform-provider-edgio
Then you can run the following command to debug the provider:
dlv exec --headless --listen=:2345 --api-version=2 ./terraform-provider-edgio
Once Dlv is running, attach to the process with your IDE, once Dlv detects the connection, it will output the following message:
Provider started. To attach Terraform CLI, set the TF_REATTACH_PROVIDERS environment variable with the following:
TF_REATTACH_PROVIDERS='{"hashicorp.com/edu/edgio":{"Protocol":"grpc","ProtocolVersion":6,"Pid":62355,"Test":true,"Addr":{"Network":"unix","String":"/var/folders/hc/mcfd08xn3k55gxznww512l_80000gn/T/plugin4155344464"}}}'
Copy the TF_REATTACH_PROVIDERS
environment variable and set it in your terminal, then you can run the terraform command you want to debug.
To run the tests, tou first need to set TF_ACC environment variable to run acceptance tests:
export TF_ACC=1
Then you can run unit tests:
go test ./internal/edgio_provider/... -v
And for integeration tests:
go test internal/integration_tests -v