pulumi / pulumi-azure

A Microsoft Azure Pulumi resource package, providing multi-language access to Azure
Apache License 2.0
131 stars 50 forks source link

Incorrect camelCase and name for TemplateDeployment's example usage in the Python SDK #615

Open albert-zhong opened 4 years ago

albert-zhong commented 4 years ago

In sdk/python/pulumi_azure/core/template_deployment.py, an example is given on how to deploy an ARM template:

## Example Usage
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West US")
example_template_deployment = azure.core.TemplateDeployment("exampleTemplateDeployment",
     resource_group_name=example_resource_group.name,
     template_body=<JSON template here...>,
     parameters={
          "storageAccountType": "Standard_GRS",
     },
     deployment_mode="Incremental"
)
pulumi.export("storageAccountName", example_template_deployment.outputs["storageAccountName"])
  1. I get error: could not make instance of 'azure:core/templateDeployment:TemplateDeployment': name 'exampletemplatedeployment' plus 8 random chars is longer than maximum length 24 when running pulumi up, so perhaps the name should be shortened when declaring example_template_deployment?

  2. After fixing that, everything works fine except for the last statement when example_template_deployment.outputs["storageAccountName"] is called. I got a KeyError when trying to get this value. Justin told me there was weird behavior with mapping snake_case to camelCase in Python. So, I then I tried changing example_template_deployment.outputs["storageAccountName"] to example_template_deployment.outputs["storage_account_name"], which seemed to fix it.

stack72 commented 3 years ago

Hi @justinvp

Is this something that was fixed with the last round of Python SDK changes?

P.