From 85de4e7ada82ff30939c3ce03e2b9bf72543d6ca Mon Sep 17 00:00:00 2001 From: "Giau. Tran Minh" Date: Mon, 9 Sep 2024 17:59:55 +0700 Subject: [PATCH] builder: remove `atlas.env` from the generated config --- internal/provider/builder.go | 6 +----- internal/provider/builder_test.go | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/provider/builder.go b/internal/provider/builder.go index 4d9dc0f..ff262fa 100644 --- a/internal/provider/builder.go +++ b/internal/provider/builder.go @@ -53,7 +53,7 @@ type ( ) // we will allow the user configure the base atlas.hcl file -const baseAtlasHCL = "env {\n}" +const baseAtlasHCL = "env {\n name = atlas.env\n}" // Render writes the atlas config to the given writer. func (c *projectConfig) Render(w io.Writer) error { @@ -83,10 +83,6 @@ func (c *projectConfig) File() *hclwrite.File { } if env := c.Env; env != nil { e := r.AppendNewBlock("env", nil).Body() - e.SetAttributeTraversal("name", hcl.Traversal{ - hcl.TraverseRoot{Name: "atlas"}, - hcl.TraverseAttr{Name: "env"}, - }) if env.URL != "" { e.SetAttributeValue("url", cty.StringVal(env.URL)) } diff --git a/internal/provider/builder_test.go b/internal/provider/builder_test.go index 49343af..c09f931 100644 --- a/internal/provider/builder_test.go +++ b/internal/provider/builder_test.go @@ -127,8 +127,8 @@ func Test_SchemaTemplate(t *testing.T) { out := &bytes.Buffer{} require.NoError(t, data.Render(out)) require.Equal(t, `env { - dev = "mysql://user:pass@localhost:3307/tf-db" name = atlas.env + dev = "mysql://user:pass@localhost:3307/tf-db" src = "file://schema.hcl" url = "mysql://user:pass@localhost:3306/tf-db" diff {