Skip to content

Conversation

lantoli
Copy link
Collaborator

@lantoli lantoli commented Feb 13, 2025

Description

Convert tags, labels, timeouts, advanced_configuration, bi_connector_config and pinned_fcv.

It also improves arrays formatting.

Link to any related issue(s): CLOUDP-299725

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@github-actions github-actions bot added the enhancement New feature or request label Feb 13, 2025
@lantoli lantoli marked this pull request as ready for review February 13, 2025 17:58
@lantoli lantoli requested a review from a team as a code owner February 13, 2025 17:58
return ret
}

// RemoveLeadingNewline removes the first newline if it exists to make the output prettier.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

e.g for timeouts, HC funcs don't delete the newline after the block is opened

instance_size = "M10"
disk_size_gb = 100
}
}, {
Copy link
Collaborator Author

@lantoli lantoli Feb 13, 2025

Choose a reason for hiding this comment

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

change format for arrays because TF formatting is not clear when arrays bracket are with the first/last object, the intermediate }, { is not indented correctly.

This format takes a few more lines but it's more clear, especially for long cluster definitions.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice!!

Copy link
Contributor

@EspenAlbert EspenAlbert left a comment

Choose a reason for hiding this comment

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

Very nice work!

@lantoli lantoli changed the title feat: Convert tag, labels and timeouts feat: Convert tags, labels, timeouts, advanced_configuration, bi_connector_config and pinned_fcv Feb 14, 2025
}
fillBlockOpt(resourceb, nTimeouts)
fillBlockOpt(resourceb, nAdvConf)
fillBlockOpt(resourceb, nBiConnector)
Copy link
Contributor

Choose a reason for hiding this comment

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

love this 1 line additions

]
tags = {
environment = "dev"
(var.tag_key) = var.tag_value
Copy link
Contributor

Choose a reason for hiding this comment

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

NICE!

Copy link
Contributor

@EspenAlbert EspenAlbert left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all comments!

@lantoli lantoli merged commit 67308ea into main Feb 14, 2025
6 checks passed
@lantoli lantoli deleted the CLOUDP-299725_tags_labels_timeouts branch February 14, 2025 10:49
Copy link
Contributor

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +16 to +20
pinned_fcv {
# comments in pinned_fcv are kept
expiration_date = var.fcv_date
version = var.fcv_date
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: version is a computed-only attribute in both cluster and advanced_cluster so no need to handle it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, thanks, we're just moving the block entirely, but will remove the version attribute in a follow-up PR so the example is more real

Copy link
Contributor

Choose a reason for hiding this comment

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

@lantoli nit: it's preferable to comment the code and create a CLOUDP to help everyone giving confidence we don't forget this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's addressed in this commit: 1665c65
in this PR: #22

provider_name = "AWS"
provider_instance_size_name = "M10"
replication_specs {
num_shards = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

question not related to PR, how will we handle num_shards > 1? Will we have logic in the conversion to define multiple replication specs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to be honest, i haven't thought about it yet, but I guess it'll be in the func creating the replication_specs, that will create multiple ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants