Giter VIP home page Giter VIP logo

Comments (10)

andyt530 avatar andyt530 commented on July 28, 2024 1

should be in better shape for you now. Let me know how you get on

from py-az2tf.

andyt530 avatar andyt530 commented on July 28, 2024 1

posted up some fixes - please give it another go - will test more thoroughly later.

from py-az2tf.

andyt530 avatar andyt530 commented on July 28, 2024

Hi,

Could you post some of the debug output please using:

./az2tf.sh -s yoursub -r automation_account -v yes -d yes

This will help me see what's going on in your case.

from py-az2tf.

samhodgkinson avatar samhodgkinson commented on July 28, 2024

Please see below

python2.7 ../../scripts/az2tf.py -s 9acaa416-e542-46e1-855d-e207e2582998 -r automation_account -d yes 2>&1 | tee -a import.log
resource filter=automation_account
Debug=True
Get Access Token from CLI
Subscription: 9acaa416-e542-46e1-855d-e207e2582998
Found subscription 9acaa416-e542-46e1-855d-e207e2582998 proceeding ...

azurerm_automation_account 8

{
"name": "Automation",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/Automation",
"location": "westeurope",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-03-07T13:57:33.25+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__Automation {
name = "Automation"
location = "westeurope"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

{
"name": "Automation2",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/Automation2",
"location": "West Europe",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-04-05T12:56:29.12+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__Automation2 {
name = "Automation2"
location = "West Europe"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

{
"name": "Automation3",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/Automation3",
"location": "West Europe",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-04-05T12:57:47.927+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__Automation3 {
name = "Automation3"
location = "West Europe"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

{
"name": "Automation4",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/Automation4",
"location": "West Europe",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-04-05T13:03:31.457+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__Automation4 {
name = "Automation4"
location = "West Europe"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

{
"name": "Automation5",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/Automation5",
"location": "West Europe",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-04-05T13:10:29.907+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__Automation5 {
name = "Automation5"
location = "West Europe"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

{
"name": "automation-NM",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/automation-NM",
"location": "westeurope",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-04-08T21:37:02.69+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__automation-NM {
name = "automation-NM"
location = "westeurope"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

{
"name": "Kickstart",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/Kickstart/providers/Microsoft.Automation/automationAccounts/Kickstart",
"location": "westeurope",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:45.853+00:00",
"creationTime": "2019-05-01T13:03:55+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account kickstart__Kickstart {
name = "Kickstart"
location = "westeurope"
resource_group_name = "Kickstart"
sku_name = "Basic"
tags = {
}
}

{
"name": "efewfefe",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Automation/automationAccounts/efewfefe",
"location": "uksouth",
"type": "Microsoft.Automation/AutomationAccounts",
"properties": {
"lastModifiedTime": "2019-07-23T01:33:46.57+00:00",
"creationTime": "2019-04-05T13:29:24.96+00:00"
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_automation_account 123__efewfefe {
name = "efewfefe"
location = "uksouth"
resource_group_name = "123"
sku_name = "Basic"
tags = {
}
}

terraform init
There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Missing name for resource

on azurerm_automation_account.123__Automation.tf line 2:
2: resource azurerm_automation_account 123__Automation {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__Automation.tf line 2:
2: resource azurerm_automation_account 123__Automation {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource

on azurerm_automation_account.123__Automation2.tf line 2:
2: resource azurerm_automation_account 123__Automation2 {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__Automation2.tf line 2:
2: resource azurerm_automation_account 123__Automation2 {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource

on azurerm_automation_account.123__Automation3.tf line 2:
2: resource azurerm_automation_account 123__Automation3 {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__Automation3.tf line 2:
2: resource azurerm_automation_account 123__Automation3 {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource

on azurerm_automation_account.123__Automation4.tf line 2:
2: resource azurerm_automation_account 123__Automation4 {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__Automation4.tf line 2:
2: resource azurerm_automation_account 123__Automation4 {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource

on azurerm_automation_account.123__Automation5.tf line 2:
2: resource azurerm_automation_account 123__Automation5 {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__Automation5.tf line 2:
2: resource azurerm_automation_account 123__Automation5 {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource

on azurerm_automation_account.123__automation-NM.tf line 2:
2: resource azurerm_automation_account 123__automation-NM {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__automation-NM.tf line 2:
2: resource azurerm_automation_account 123__automation-NM {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource

on azurerm_automation_account.123__efewfefe.tf line 2:
2: resource azurerm_automation_account 123__efewfefe {

All resource blocks must have 2 labels (type, name).

Error: Invalid block definition

on azurerm_automation_account.123__efewfefe.tf line 2:
2: resource azurerm_automation_account 123__efewfefe {

Either a quoted string block label or an opening brace ("{") is expected here.

Error: Missing name for resource
Error: Invalid block definition
Error: Missing name for resource
Error: Invalid block definition
Error: Missing name for resource
Error: Invalid block definition
Error: Missing name for resource
Error: Invalid block definition
Error: Missing name for resource
Error: Invalid block definition
Error: Missing name for resource
Error: Invalid block definition
Error: Missing name for resource
Error: Invalid block definition
Error with terraform init

from py-az2tf.

andyt530 avatar andyt530 commented on July 28, 2024

This seems to be down to your resource group name starting with a number
That resource group name is used as part of the terraform resource name eg "123__efewfefe"
And terraform doesn't seem to like the resource name beginning with a number

If I change it so it starts with a letter:
resource azurerm_automation_account r123__efewfefe {

It validates ok.

I'll have to check the terraform docs to see it this is a bug or expected behaviour for resource names.

from py-az2tf.

andyt530 avatar andyt530 commented on July 28, 2024

started posting fixes for this - I have to change every provider. But I started with the ones you are seeing errors on.

from py-az2tf.

samhodgkinson avatar samhodgkinson commented on July 28, 2024

This looks loads better, ran a fuller lookup. If I only have numbers, these resource groups still fail. These are testing resource groups, so I would not normally deploy them like this.

I am seeing issues with an interpolation expression

terraform init
There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Extra characters after interpolation expression

on azurerm_network_interface.rg_123__test01938.tf line 8, in resource "azurerm_network_interface" "rg_123__test01938":
8: network_security_group_id = "${azurerm_network_security_group.123__test01-nsg.id}"

Expected a closing brace to end the interpolation expression, but found extra
characters.

Error: Extra characters after interpolation expression

{
"name": "test01938",
"tags": {},
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Network/networkInterfaces/test01938",
"etag": "W/"8059d985-bf1b-44f8-a8bf-c6ee83bd23bc"",
"location": "ukwest",
"type": "Microsoft.Network/networkInterfaces",
"properties": {
"provisioningState": "Succeeded",
"dnsSettings": {
"dnsServers": [],
"appliedDnsServers": []
},
"networkSecurityGroup": {
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Network/networkSecurityGroups/test01-nsg"
},
"resourceGuid": "41e04110-bf30-4db9-8522-2210951ed9df",
"enableIPForwarding": false,
"ipConfigurations": [
{
"properties": {
"subnet": {
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Network/virtualNetworks/123-vnet/subnets/default"
},
"primary": true,
"privateIPAddressVersion": "IPv4",
"publicIPAddress": {
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Network/publicIPAddresses/test01-ip"
},
"privateIPAllocationMethod": "Dynamic",
"privateIPAddress": "10.0.0.4",
"provisioningState": "Succeeded"
},
"etag": "W/"8059d985-bf1b-44f8-a8bf-c6ee83bd23bc"",
"type": "Microsoft.Network/networkInterfaces/ipConfigurations",
"name": "ipconfig1",
"id": "/subscriptions/9acaa416-e542-46e1-855d-e207e2582998/resourceGroups/123/providers/Microsoft.Network/networkInterfaces/test01938/ipConfigurations/ipconfig1"
}
],
"enableAcceleratedNetworking": false
}
}

File generated by py-az2tf see: https://github.com/andyt530/py-az2tf

resource azurerm_network_interface rg_123__test01938 {
name = "test01938"
location = "ukwest"
resource_group_name = "123"
enable_ip_forwarding = false
enable_accelerated_networking = false
network_security_group_id = "${azurerm_network_security_group.123__test01-nsg.id}"
ip_configuration {
name = "ipconfig1"
subnet_id = "${azurerm_subnet.123__default.id}"
private_ip_address_allocation = "Dynamic"
public_ip_address_id = "${azurerm_public_ip.123__test01-ip.id}"
primary = true
}
tags = {
}
}

from py-az2tf.

andyt530 avatar andyt530 commented on July 28, 2024

working on fixes for that .....

from py-az2tf.

samhodgkinson avatar samhodgkinson commented on July 28, 2024

Thanks, tested and just the expected warnings for NSG and route association. I will test this across some other subscriptions and let you know If I find anything else.

from py-az2tf.

samhodgkinson avatar samhodgkinson commented on July 28, 2024

Tested this on 6 other subs no other issues found

from py-az2tf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.