Skip to content

feat: Convert from blocks to nested attributes in advancedClusterToV2 command #61

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/cli/clu2adv/clu2adv.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (

func Builder() *cobra.Command {
o := &struct {
*cli.BaseOpts
cli.BaseOpts
includeMoved bool
}{
BaseOpts: &cli.BaseOpts{
BaseOpts: cli.BaseOpts{
Fs: afero.NewOsFs(),
},
}
Expand All @@ -28,7 +28,7 @@ func Builder() *cobra.Command {
Aliases: []string{"clu2adv"},
RunE: o.RunE,
}
cli.SetupCommonFlags(cmd, o.BaseOpts)
cli.SetupCommonFlags(cmd, &o.BaseOpts)
cmd.Flags().BoolVarP(&o.includeMoved, flag.IncludeMoved, flag.IncludeMovedShort, false,
"include moved blocks in the output file")
return cmd
Expand Down
18 changes: 15 additions & 3 deletions internal/convert/testdata/adv2v2/basic.in.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
resource "mongodbatlas_advanced_cluster" "basic" {
name = "basic"
// TODO: missing fields as transformation is not implemented yet
resource "mongodbatlas_advanced_cluster" "clu" {
project_id = "66d979971ec97b7de1ef8777"
name = "clu"
cluster_type = "REPLICASET"
replication_specs {
region_configs {
priority = 7
provider_name = "AWS"
region_name = "EU_WEST_1"
electable_specs {
instance_size = "M10"
node_count = 3
}
}
}
}
24 changes: 21 additions & 3 deletions internal/convert/testdata/adv2v2/basic.out.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
resource "mongodbatlas_advanced_cluster" "basic" {
name = "basic"
// TODO: missing fields as transformation is not implemented yet
resource "mongodbatlas_advanced_cluster" "clu" {
project_id = "66d979971ec97b7de1ef8777"
name = "clu"
cluster_type = "REPLICASET"
replication_specs = [
{
region_configs = [
{
priority = 7
provider_name = "AWS"
region_name = "EU_WEST_1"
electable_specs = {
node_count = 3
instance_size = "M10"
}
}
]
}
]

# Updated by atlas-cli-plugin-terraform, please review the changes.
}
Loading