diff --git a/builtin/providers/terraform/data_source_state.go b/builtin/providers/terraform/data_source_state.go index d8c97ebd52..c87da01fba 100644 --- a/builtin/providers/terraform/data_source_state.go +++ b/builtin/providers/terraform/data_source_state.go @@ -55,7 +55,14 @@ func dataSourceRemoteStateRead(d *schema.ResourceData, meta interface{}) error { d.SetId(time.Now().UTC().String()) outputMap := make(map[string]interface{}) - for key, val := range state.State().RootModule().Outputs { + + remoteState := state.State() + if remoteState.Empty() { + log.Println("[DEBUG] empty remote state") + return nil + } + + for key, val := range remoteState.RootModule().Outputs { outputMap[key] = val.Value }