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{}) outputMap := output.(map[string]interface{})
outputValue, ok := outputMap["value"] outputValue, ok := outputMap["value"]
if !ok { if !ok {
// No value log.Printf("[DEBUG] No value - skipping")
continue continue
} }
outputType := outputMap["type"] outputType, ok := outputMap["type"]
var outputStringValue string if !ok {
log.Printf("[DEBUG] No type - skipping")
switch outputType { continue
case "Bool":
if outputValue == false {
outputStringValue = "0"
} else if outputValue == true {
outputStringValue = "1"
} else {
return fmt.Errorf("Invalid value %s for boolean output %s", outputValue, key)
} }
case "String": // Nothing to do var outputValueString string
fallthrough switch strings.ToLower(outputType.(string)) {
case "Int": case "bool":
outputStringValue = fmt.Sprint(outputValue) // Use explicit "0"/"1" strings for boolean
if outputValue.(bool) {
outputValueString = "1"
} else {
outputValueString = "0"
}
case "string":
outputValueString = outputValue.(string)
case "int":
outputValueString = fmt.Sprint(outputValue)
case "SecureString", "Object", "SecureObject", "Array":
fallthrough
default: 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) key, outputType)
continue continue
} }
outputs[key] = outputValueString
outputs[key] = outputStringValue
} }
} }

View File

@ -98,7 +98,7 @@ The following arguments are supported:
The following attributes are exported: The following attributes are exported:
* `id` - The Template Deployment ID. * `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 ## Note