Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting JSON into tf data #8

Open
waghanza opened this issue Oct 18, 2017 · 5 comments
Open

Converting JSON into tf data #8

waghanza opened this issue Oct 18, 2017 · 5 comments

Comments

@waghanza
Copy link

Hi,

I want to convert some json into terraform readable format.

However, we I use :

curl -sSl https://raw.githubusercontent.com/kvz/json2hcl/master/fixtures/infra.tf.json | json2hcl

The output seems not to be readable by terraform.

Is it any step more to do ?

Regards,

@jacksonp2008
Copy link

I see the same thing. Exported automation package from Azure which contains template.json

$ json2hcl < template.json > template.tf
$ 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: Error parsing /ExportedTemplate-RG-ATM-KIT002/template.tf: At 8:10: no object keys found!

Either I am doing this incorrectly or it doesn't work. Looking at the output to template.tf, it doesn't appear to be terraform code.

Sure would be cool if this worked. The underlying question is why M$ doesn't support this natively on AZ.

@Acconut
Copy link
Collaborator

Acconut commented Dec 27, 2018

Would you mind sharing the sections of your template.json which is responsible for this error?

@jacksonp2008
Copy link

I would more comfortable with sharing the AZ configs if I knew who you are. I'm sure you're awesome but this is a public forum.

Just do this:

  • Log into your AZ account'
  • pick a resource group
  • download the automation script

Doesn't work... well for me anyway

@Acconut
Copy link
Collaborator

Acconut commented Dec 29, 2018

I can understand that you do not want to share your configuration publicly but maybe you are able to remove the confident information from it or provide a minimal example which triggers the error (Error: no object keys found!). I am sorry, but I don't have the time to sign up for an Azure account just to test this out.

@jacksonp2008
Copy link

try this
template.json.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants