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

internal/controller: use hcl pkg to generate atlas.hcl for declarative flow #239

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

datdao
Copy link
Member

@datdao datdao commented Dec 6, 2024

This PR changes the logic for generating atlas.hcl by using the HCL package instead of a template. By applying this approach, we can easily merge another Atlas config file into the existing one since they follow the same HCL model.

@datdao datdao force-pushed the d/support-atlas-config branch 7 times, most recently from 0f5545f to 8308fdc Compare December 10, 2024 09:46
@datdao datdao requested review from giautm and rotemtam December 10, 2024 09:56
@datdao datdao marked this pull request as ready for review December 10, 2024 09:56
@datdao datdao force-pushed the d/support-atlas-config branch from 8308fdc to a7db0ab Compare December 10, 2024 10:45
@datdao datdao force-pushed the d/support-atlas-config branch from a7db0ab to 6b40867 Compare December 10, 2024 10:51
@datdao datdao requested a review from giautm December 10, 2024 11:03
// asBlocks returns the HCL block for the environment configuration.
func (d *managedData) asBlocks() []*hclwrite.Block {
var blocks []*hclwrite.Block
env := hclwrite.NewBlock("env", []string{d.EnvName})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env shouldn't have no labels.

Suggested change
env := hclwrite.NewBlock("env", []string{d.EnvName})
env := hclwrite.NewBlock("env", nil)

drop_schema = true
drop_table = true
expected := `env "kubernetes" {
url = "mysql://root:password@localhost:3306/test"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env block should have no label, and the name attribute should set to name = atlas.env

@datdao datdao merged commit e4482e2 into master Dec 11, 2024
6 checks passed
@datdao datdao deleted the d/support-atlas-config branch December 11, 2024 05:48
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

Successfully merging this pull request may close these issues.

2 participants