Documentation ¶
Index ¶
- Variables
- func NewResource() resource.Resource
- type Resource
- 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)
- type State
Constants ¶
This section is empty.
Variables ¶
var Schema = schema.Schema{ MarkdownDescription: resourceDescription, Attributes: map[string]schema.Attribute{ "name": schema.StringAttribute{ Description: "Lighthouse's name", Required: true, Validators: []validator.String{ stringvalidator.LengthAtMost(255), }, }, "network_id": schema.StringAttribute{ Description: "Enrolled Network ID", Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), }, }, "role_id": schema.StringAttribute{ Description: "Lighthouse's role ID on Defined.net", Optional: true, }, "static_addresses": schema.ListAttribute{ Description: "Lighthouse's static IP addresses", ElementType: types.StringType, Required: true, Validators: []validator.List{ listvalidator.UniqueValues(), listvalidator.ValueStringsAre(validation.IPAddress()), }, }, "listen_port": schema.Int32Attribute{ Description: "Lighthouse's listen port", Required: true, }, "tags": schema.ListAttribute{ Description: "Lighthouse's tags on Defined.net", ElementType: types.StringType, Optional: true, Validators: []validator.List{ listvalidator.UniqueValues(), listvalidator.ValueStringsAre(validation.HostTag()), }, }, "id": schema.StringAttribute{ Description: "Lighthouse's ID", Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, }, "ip_address": schema.StringAttribute{ Description: "Lighthouse's IP address on Defined.net overlay network", Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, }, "enrollment_code": schema.StringAttribute{ Description: "Lighthouse's enrollment code", Sensitive: true, Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, }, }, }
Schema is the lighthouse resource's schema.
Functions ¶
func NewResource ¶
NewResource creates a Defined.net Nebula lighthouse resource.
Types ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource is Defined.net Nebula lighthouse resource.
func (*Resource) Configure ¶
func (r *Resource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
Configure configures the resource.
func (*Resource) Create ¶
func (r *Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
Create creates Nebula lighthouses on Defined.net control plane.
func (*Resource) Delete ¶
func (r *Resource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
Delete deletes Nebula lighthouses from Defined.net control plane.
func (*Resource) ImportState ¶
func (r *Resource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
ImportState imports Nebula lighthouses from Defined.net control plane.
func (*Resource) Metadata ¶
func (r *Resource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
Metadata returns the resource's metadata.
func (*Resource) Read ¶
func (r *Resource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
Read reads Nebula lighthouses from Defined.net control plane.
func (*Resource) Schema ¶
func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
Schema returns the resource's configuration schema.
func (*Resource) Update ¶
func (r *Resource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Update updates Nebula lighthouses on Defined.net control plane.
type State ¶
type State struct { ID types.String `tfsdk:"id"` NetworkID types.String `tfsdk:"network_id"` RoleID types.String `tfsdk:"role_id"` StaticAddresses types.List `tfsdk:"static_addresses"` ListenPort types.Int32 `tfsdk:"listen_port"` Name types.String `tfsdk:"name"` IPAddress types.String `tfsdk:"ip_address"` Tags types.List `tfsdk:"tags"` EnrollmentCode types.String `tfsdk:"enrollment_code"` }
State is the lighthouse resource's state.
func (*State) ApplyEnrollment ¶
func (s *State) ApplyEnrollment(ctx context.Context, enrollment *definednet.Enrollment) (diags diag.Diagnostics)
ApplyEnrollment applies Defined.net host enrollment information to the state.
func (*State) ApplyHost ¶
func (s *State) ApplyHost(ctx context.Context, lighthouse *definednet.Host) (diags diag.Diagnostics)
ApplyHost applies Defined.net lighthouse information to the state.