Guide: New Service Package#
There's a few steps involved in adding a new Service Package.
-
Create a new directory within
./internal/services
with the Service Name (see naming). -
Create an empty Client within the Service Package (
./internal/services/{name}/client/client.go
):
package client
import (
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)
type Client struct {
}
func NewClient(o *common.ClientOptions) *Client {
return &Client{}
}
- Create an empty Registration within the Service Package (
./internal/services/{name}/registration.go
) which implements theTypedServiceRegistration
interface:
package {name}
import (
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
)
type Registration struct{}
var (
_ sdk.TypedServiceRegistration = Registration{}
)
func (r Registration) DataSources() []sdk.DataSource {
return []sdk.DataSource{}
}
func (r Registration) Resources() []sdk.Resource {
return []sdk.Resource{}
}
// Name is the name of this Service
func (r Registration) Name() string {
return "App Service"
}
// WebsiteCategories returns a list of categories which can be used for the sidebar
func (r Registration) WebsiteCategories() []string {
return []string{
"App Service",
}
}
- Register the Service Registration.
- Define and Register the Client for this Service Package.
- Add this to the Client struct.
- Call the Register function.
- Re-run the generation to ensure the generated files are up to date (
make generate
).
At this point the Service Package should be registered, and you can build a new Data Source or a new Resource as required.