Re: [terraform] How to use JSON file as input (value of a variable) in Terraform configuration file?

1,895 views
Skip to first unread message
Message has been deleted

Marco Aurélio

unread,
May 17, 2019, 9:27:51 AM5/17/19
to terrafo...@googlegroups.com
Hi Gary,

You can use the "heredoc" style as described here: https://www.terraform.io/docs/configuration/expressions.html#string-literals
That way you should be able to specify the JSON attribute in the following manner:
resource "aws_dms_replication_task" "test" {

...

 table_mappings = <<EOF
{
"Key": "value
}
EOF

...

 }


Em qui, 16 de mai de 2019 às 22:48, Gary Yang <gary.y...@gmail.com> escreveu:
Hello! I am new to Terraform, and would appreciate any advice.

I need to create a resource of aws_dms_replication_task. For the two arguments "replication_task_settings" and "table_mappings", I already have JSON files from AWS CLI. Could you please guide me to use JSON files as input? Also, if could point me to a reference document, it would be a great help. The Terraform document only tells me to use escaped JSON string for these two arguments, which is hard to code and read because my table mappings are very complex.

Thank you in advance.

Gary

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/577095ef-3291-484f-873c-6e75618872be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Marco Godinho
(47) 99186 8760

Gary Yang

unread,
May 22, 2019, 9:59:00 PM5/22/19
to terrafo...@googlegroups.com
Marco,

Thank you very much !

Gary

Reply all
Reply to author
Forward
0 new messages