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

INTMDB-128: Modified design when you can get .id from various resources #471

Merged
merged 5 commits into from
Jun 10, 2021

Conversation

coderGo93
Copy link
Contributor

  • Refactor when you can get id if you are using encoded state id or only id like container_id from various resource

Description

Please include a summary of the fix/feature/change, including any relevant motivation and context.

Link to any related issue(s):

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the Terraform contribution guidelines
  • 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

Further comments

#320

Edgar López added 2 commits June 4, 2021 16:29
…cit depedency with id from various resources instead of another id like container_id
@coderGo93 coderGo93 self-assigned this Jun 4, 2021
@themantissa themantissa requested review from a team and threebee and removed request for a team June 4, 2021 23:08
@leofigy
Copy link
Contributor

leofigy commented Jun 5, 2021

Okay adding the explanation here.
The idea is to be able to support both the regular resource ID, and decode on-behalf of the user the resource ID that is embedded in the internal ID. because there have been a lot of confusions, on which ID to use.

Copy link
Contributor

@leofigy leofigy left a comment

Choose a reason for hiding this comment

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

Hi @coderGo93 awesome work, just one request could we create a terratest for all the modified resources, just for the sake of sanity.

And in addition to this could we add a datasource for project , and re-use the id of that datasource in the other resources.

@coderGo93 coderGo93 requested a review from leofigy June 9, 2021 01:57
ImportState: true,
ImportStateVerify: true,
ResourceName: resourceName,
ImportStateIdFunc: testAccCheckMongoDBAtlasPrivateLinkEndpointServiceImportStateIDFunc(resourceName),
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a question, is it necessary to use so long func names?

I mean, in this method you are in mongodbatlas_privatelink_endpoint...method, maybe the name for this func can be testAccCheckServiceImportStateIDFunc

having names like this can affect the readability and the maintainability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As long it doesn't cross the limit of the line-length from golangci.yml it should be fine, mm it seems readable for me since it's usually testAccCheckMongoDBAtlas[Resource/datasource][Extra(like ImportState, destroy, etc] something like that, but it somehow it crosses the limit, yes it would be nice to shorten it and still readable for the resource it belongs to

Copy link
Contributor

@abner-dou abner-dou left a comment

Choose a reason for hiding this comment

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

LGTM!
(I just left one question, but is not so important)

Copy link

@threebee threebee left a comment

Choose a reason for hiding this comment

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

LGTM!

@coderGo93
Copy link
Contributor Author

Hi @coderGo93 awesome work, just one request could we create a terratest for all the modified resources, just for the sake of sanity.

And in addition to this could we add a datasource for project , and re-use the id of that datasource in the other resources.

Done, thank you for the suggestion @leofigy

@coderGo93 coderGo93 merged commit 37ab770 into master Jun 10, 2021
@coderGo93 coderGo93 deleted the INTMDB-128 branch June 10, 2021 15:44
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.

4 participants