func()

in internal/provider/telemetry_resource.go [141:162]


func (r *TelemetryResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
	data := &TelemetryResourceModel{}

	// Read Terraform plan data into the model
	resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...)

	if resp.Diagnostics.HasError() {
		return
	}

	newId := uuid.NewString()
	data.Id = types.StringValue(newId)
	if data.Nonce.IsUnknown() {
		data.Nonce = types.NumberNull()
	}
	if data.EphemeralNumber.IsUnknown() {
		data.EphemeralNumber = types.NumberNull()
	}
	traceLog(ctx, fmt.Sprintf("created telemetry resource with id %s", newId))
	data.sendTags(ctx, r, "create")
	resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
}