Documentation ¶
Overview ¶
Package servicevcl implements a service resource.
Index ¶
- func NewResource() func() resource.Resource
- type Resource
- func (r Resource) ConfigValidators(_ context.Context) []resource.ConfigValidator
- func (r *Resource) Configure(_ context.Context, req resource.ConfigureRequest, ...)
- func (r *Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *Resource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *Resource) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r *Resource) Metadata(_ context.Context, req resource.MetadataRequest, ...)
- func (r *Resource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r *Resource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResource ¶
NewResource returns a new Terraform resource instance.
Types ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource defines the resource implementation.
func (Resource) ConfigValidators ¶
func (r Resource) ConfigValidators(_ context.Context) []resource.ConfigValidator
ConfigValidators returns a list of functions which will all be performed during validation. https://developer.hashicorp.com/terraform/plugin/framework/resources/validate-configuration#configvalidators-method
func (*Resource) Configure ¶
func (r *Resource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
Configure includes provider-level data or clients.
func (*Resource) Create ¶
func (r *Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
Create is called when the provider must create a new resource. Config and planned state values should be read from the CreateRequest. New state values set on the CreateResponse.
func (*Resource) Delete ¶
func (r *Resource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
Delete is called when the provider must delete the resource. Config values may be read from the DeleteRequest.
If execution completes without error, the framework will automatically call DeleteResponse.State.RemoveResource().
func (*Resource) ImportState ¶
func (r *Resource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
ImportState is called when the provider must import the state of a resource instance.
The resource's ID is set into the state and its Read() method called. If we look at the Read() method in ./process_read.go we'll see it calls `ServiceAPI.GetServiceDetail()` passing in the ID the user specifies.
e.g. `terraform import ADDRESS ID` https://developer.hashicorp.com/terraform/cli/commands/import#usage`
The service resource then iterates over all nested resources populating the state for each nested resource.
func (*Resource) Metadata ¶
func (r *Resource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
Metadata should return the full name of the resource.
func (*Resource) Read ¶
func (r *Resource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
Read is called when the provider must read resource values in order to update state. Planned state values should be read from the ReadRequest. New state values set on the ReadResponse.
TODO: How to handle name/comment which are versionless and don't need `activate`.
func (*Resource) Schema ¶
func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
Schema should return the schema for this resource.
NOTE: Some optional attributes are also 'computed' so we can set a default.
func (*Resource) Update ¶
func (r *Resource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Update is called to update the state of the resource. Config, planned state, and prior state values should be read from the UpdateRequest. New state values set on the UpdateResponse.