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