From e7220f7e9283a4320ca80d93b843a71998ce1ff9 Mon Sep 17 00:00:00 2001 From: Greg Althaus Date: Tue, 21 Mar 2023 11:49:14 -0500 Subject: [PATCH] fix: store provider data for resource later Signed-off-by: Greg Althaus --- drpv4/provider.go | 1 + drpv4/resource_drp_machine.go | 1 + 2 files changed, 2 insertions(+) diff --git a/drpv4/provider.go b/drpv4/provider.go index 9ed63f1..c2cea9e 100644 --- a/drpv4/provider.go +++ b/drpv4/provider.go @@ -197,6 +197,7 @@ func (p *Config) Configure(ctx context.Context, req provider.ConfigureRequest, r } log.Printf("[Info] Digital Rebar %+v", info.Version) + resp.ResourceData = p } func (p *Config) Resources(ctx context.Context) []func() resource.Resource { diff --git a/drpv4/resource_drp_machine.go b/drpv4/resource_drp_machine.go index f707937..435c982 100644 --- a/drpv4/resource_drp_machine.go +++ b/drpv4/resource_drp_machine.go @@ -151,6 +151,7 @@ func (r *MachineResource) Schema(ctx context.Context, req resource.SchemaRequest func (r *MachineResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { // Prevent panic if the provider has not been configured. if req.ProviderData == nil { + tflog.Error(ctx, "[resourceMachineConfigure] Missing provider data") return }