virtuald/pyhcl

Fails to load multiple resources of the same time.

nelg opened this issue · 4 comments

nelg commented

The following TF is not loaded correctly. It does not create the first resource in the output json.

sampleinput.tf

resource "aws_db_instance" "mysqldb" {
    identifier = "${var.environment}-mysqldb"
    allocated_storage = 100
}
resource "aws_db_instance" "mysqldb-readonly" {
    identifier = "${var.environment}-mysqldb-readonly"
    allocated_storage = 100
}

JSON Output is:

{
    "resource": {
        "aws_db_instance": {
            "mysqldb-readonly": {
                "allocated_storage": 100,
                "identifier": "${var.environment}-mysqldb-readonly"
            }
        }
    }
}

Expected:

{
    "resource": {
        "aws_db_instance": {
           "mysqldb": {
                "allocated_storage": 100,
                "identifier": "${var.environment}-mysqldb"
            },
            "mysqldb-readonly": {
                "allocated_storage": 100,
                "identifier": "${var.environment}-mysqldb-readonly"
            }
        }
    }
}

This seems related to #11 . Feel free to fix it and submit a pull request.

nelg commented

I would but not sure how to fix it, and have limited time to do so.

Glen
On 11/08/2016 4:10 PM, "Dustin Spicuzza" notifications@github.com wrote:

This seems related to #11 #11 .
Feel free to fix it and submit a pull request.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#12 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAGOPfo8wsKqvWMUaJEjKk4IPFTx-V28ks5qeqCcgaJpZM4JhsK9
.

I don't use terraform, and have limited time to fix this bug also.

Fixed somewhere along the line in PR #68 or before. That PR enables the unit test.