1

When using "azure_rm_deployment" the resourcegroup only creating in us west location. How could i create it in any other location. Also when trying to create resources inside that resource group created in central india getting error Resource group create_or_update failed with status code: 409 and message: Invalid resource group location 'westus'. The Resource group already exists in location 'centralindia'."}

Here is my code

- name: Create Azure Deploy
  azure_rm_deployment:
    state: present
    resource_group_name: "myresources"
    parameters:
       location:
          value: Central India
    template:
      $schema: "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"
      contentVersion: "1.0.0.0"
      location: "[variables('location')]"
      deployment-name: "mypx"
      resources:
        - type: "Microsoft.Network/virtualNetworks"
          apiVersion: "2015-05-01-preview"
          name: "[variables('virtualNetworkName')]"
          location: "[parameters('location')]"
          properties:
            addressSpace:
              addressPrefixes:
                - "[variables('addressPrefix')]"
            subnets:
              - name: "[variables('subnetName')]"
                properties:
                  addressPrefix: "[variables('subnetPrefix')]"
New contributor
Chandra Prakash is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2

409 refers to Conflict. It means that the resource Group that you are trying to create already exists. Choose a Unique name for the resource Group. If you do not see it in portal, use Management APIs to confirm. Sometimes, portal takes a while to sync. Also, which tool are you deploying from? Does it have any option of setting defaults. It is possible that default location is set up as US west. If you can share the Json that is generated, it may provide more clues into what might be going wrong here.

New contributor
SUCHIT CHOUDHURY is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

To create the resource group in a location you choose, you have to use the location parameters, not the parameters parameter, see the documentation.

So this would give:

- name: Create Azure Deploy
  azure_rm_deployment:
    state: present
    resource_group_name: "myresources"
    location: the-desired-location

instead of

- name: Create Azure Deploy
  azure_rm_deployment:
    state: present
    resource_group_name: "myresources"
    parameters:
       location:
          value: Central India
  • Thanks, It works :) – Chandra Prakash Apr 17 at 7:51
  • Does that answer the whole question? – koudougou Apr 17 at 7:57

Your Answer

Chandra Prakash is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.