This commit is contained in:
Stephen Weatherford 2017-04-20 23:27:36 +00:00
parent d378e30b1d
commit 21cd620ef9
2 changed files with 21 additions and 20 deletions

View File

@ -159,36 +159,37 @@ func resourceArmTemplateDeploymentRead(d *schema.ResourceData, meta interface{})
outputMap := output.(map[string]interface{})
outputValue, ok := outputMap["value"]
if !ok {
// No value
log.Printf("[DEBUG] No value - skipping")
continue
}
outputType, ok := outputMap["type"]
if !ok {
log.Printf("[DEBUG] No type - skipping")
continue
}
outputType := outputMap["type"]
var outputStringValue string
switch outputType {
case "Bool":
if outputValue == false {
outputStringValue = "0"
} else if outputValue == true {
outputStringValue = "1"
var outputValueString string
switch strings.ToLower(outputType.(string)) {
case "bool":
// Use explicit "0"/"1" strings for boolean
if outputValue.(bool) {
outputValueString = "1"
} else {
return fmt.Errorf("Invalid value %s for boolean output %s", outputValue, key)
outputValueString = "0"
}
case "String": // Nothing to do
fallthrough
case "Int":
outputStringValue = fmt.Sprint(outputValue)
case "string":
outputValueString = outputValue.(string)
case "int":
outputValueString = fmt.Sprint(outputValue)
case "SecureString", "Object", "SecureObject", "Array":
fallthrough
default:
log.Printf("[WARNING] Ignoring output %s: Outputs of type %s are not currently supported in azurerm_deployment_template.",
log.Printf("[WARN] Ignoring output %s: Outputs of type %s are not currently supported in azurerm_template_deployment.",
key, outputType)
continue
}
outputs[key] = outputStringValue
outputs[key] = outputValueString
}
}

View File

@ -98,7 +98,7 @@ The following arguments are supported:
The following attributes are exported:
* `id` - The Template Deployment ID.
* `outputs` - A map of supported scalar output types returned from the deployment (currently, Azure template outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored).
* `outputs` - A map of supported scalar output types returned from the deployment (currently, Azure Template Deployment outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored).
## Note