Use false/true instead of 0/1 for bool

This commit is contained in:
Stephen Weatherford 2017-05-02 19:13:25 +00:00
parent 21cd620ef9
commit 202ed9c680
2 changed files with 4 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"net/http"
"strconv"
"strings"
"time"
@ -171,12 +172,7 @@ func resourceArmTemplateDeploymentRead(d *schema.ResourceData, meta interface{})
var outputValueString string
switch strings.ToLower(outputType.(string)) {
case "bool":
// Use explicit "0"/"1" strings for boolean
if outputValue.(bool) {
outputValueString = "1"
} else {
outputValueString = "0"
}
outputValueString = strconv.FormatBool(outputValue.(bool))
case "string":
outputValueString = outputValue.(string)

View File

@ -82,8 +82,8 @@ func TestAccAzureRMTemplateDeployment_withOutputs(t *testing.T) {
testCheckAzureRMTemplateDeploymentExists("azurerm_template_deployment.test"),
resource.TestCheckOutput("tfIntOutput", "-123"),
resource.TestCheckOutput("tfStringOutput", "Standard_GRS"),
resource.TestCheckOutput("tfFalseOutput", "0"),
resource.TestCheckOutput("tfTrueOutput", "1"),
resource.TestCheckOutput("tfFalseOutput", "false"),
resource.TestCheckOutput("tfTrueOutput", "true"),
resource.TestCheckResourceAttr("azurerm_template_deployment.test", "outputs.stringOutput", "Standard_GRS"),
),
},