@@ -35,6 +35,7 @@ func BuiltinHCL() starlark.Value {
3535
3636func (s * Provider ) ToHCL (b * hclwrite.Body ) {
3737 block := b .AppendNewBlock ("provider" , []string {s .name })
38+
3839 block .Body ().SetAttributeValue ("alias" , cty .StringVal (s .Name ()))
3940 block .Body ().SetAttributeValue ("version" , cty .StringVal (string (s .meta .Version )))
4041 s .Resource .doToHCLAttributes (block .Body ())
@@ -48,6 +49,13 @@ func (s *Provisioner) ToHCL(b *hclwrite.Body) {
4849 s .Resource .doToHCLAttributes (block .Body ())
4950}
5051
52+ func (s * Backend ) ToHCL (b * hclwrite.Body ) {
53+ parent := b .AppendNewBlock ("terraform" , nil )
54+
55+ block := parent .Body ().AppendNewBlock ("backend" , []string {s .name })
56+ s .Resource .doToHCLAttributes (block .Body ())
57+ }
58+
5159func (t * MapSchema ) ToHCL (b * hclwrite.Body ) {
5260 names := make (sort.StringSlice , len (t .collections ))
5361 var i int
@@ -75,7 +83,8 @@ func (r *Resource) ToHCL(b *hclwrite.Body) {
7583
7684 var block * hclwrite.Block
7785 if r .kind != NestedKind {
78- block = b .AppendNewBlock (string (r .kind ), []string {r .typ , r .Name ()})
86+ labels := []string {r .typ , r .Name ()}
87+ block = b .AppendNewBlock (string (r .kind ), labels )
7988 } else {
8089 block = b .AppendNewBlock (r .typ , nil )
8190 }
0 commit comments