From 9bb566dcdbe36ca0812cbdcfcf7af3faaefdcb1f Mon Sep 17 00:00:00 2001 From: Brandon Croft Date: Fri, 21 Jul 2023 10:15:58 -0600 Subject: [PATCH] Update cloudplugin type casting to simplify adding future versions --- internal/command/cloud.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/command/cloud.go b/internal/command/cloud.go index fd998d37c5..f70211e988 100644 --- a/internal/command/cloud.go +++ b/internal/command/cloud.go @@ -69,7 +69,13 @@ func (c *CloudCommand) proxy(args []string, stdout, stderr io.Writer) int { } // Proxy the request - cloud1 := raw.(cloudplugin.Cloud1) + // Note: future changes will need to determine the type of raw when + // multiple versions are possible. + cloud1, ok := raw.(cloudplugin.Cloud1) + if !ok { + c.Ui.Error("If more than one cloudplugin versions are available, they need to be added to the cloud command. This is a bug in terraform.") + return ExitRPCError + } return cloud1.Execute(args, stdout, stderr) }