-
Notifications
You must be signed in to change notification settings - Fork 178
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
chore: Creates advancedclustertpf
package for new implementation
#2679
Conversation
@@ -331,12 +334,36 @@ jobs: | |||
with: | |||
terraform_version: ${{ inputs.terraform_version }} | |||
terraform_wrapper: false | |||
- name: Prepare new advanced_cluster | |||
run: make tools enable-new-advancedcluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activate new resource implementation before running its CI tests
@@ -123,6 +123,8 @@ issues: | |||
- linters: | |||
- gocritic | |||
text: "^hugeParam: req is heavy" | |||
- path: "_schema\\.go" # exclude rules for schema files as it's auto-genereated from OpenAPI spec | |||
text: "fieldalignment|hugeParam|var-naming|ST1003|S1007|exceeds the maximum|too long|regexpSimplify|nolint" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linter exceptions for auto-generate schemas so we don't need to manually change them
GNUmakefile
Outdated
@@ -153,3 +154,24 @@ check-changelog-entry-file: | |||
.PHONY: jira-release-version | |||
jira-release-version: | |||
go run ./tools/jira-release-version/*.go | |||
|
|||
.PHONY: enable-new-advancedcluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make target to enable new resource, can also be run in local
@@ -0,0 +1,9 @@ | |||
# advancedcluster package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README files in adv_clusters to help with the transition
|
||
func configBasic() string { | ||
return ` | ||
resource "mongodbatlas_advanced_cluster" "test" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minimum test for the no-op resource, it creates and deletes the resource
@@ -9,32 +9,32 @@ import ( | |||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config" | |||
) | |||
|
|||
const {{.NameCamelCase}}Name = "{{.NameSnakeCase}}" // TODO: if resource exists this can be deleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scaffolding adjustments, all of them can be seen in this PR and how a resource changes: b9c320a
I can also move the scaffolding changes to a different PRs if that's preferred.
@@ -79,6 +79,10 @@ func filesToGenerate(params *ScaffoldParams) ([]FileGeneration, error) { | |||
TemplatePath: "tools/scaffold/template/generator_config.tmpl", | |||
OutputPath: fmt.Sprintf("%s/tfplugingen/generator_config.yml", folderPath), | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@@ -88,7 +92,7 @@ func filesToGenerate(params *ScaffoldParams) ([]FileGeneration, error) { | |||
}, | |||
{ | |||
TemplatePath: "tools/scaffold/template/acc_test.tmpl", | |||
OutputPath: fmt.Sprintf("%s/data_source_test.go", folderPath), | |||
OutputPath: fmt.Sprintf("%s/resource_test.go", folderPath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only create test file for resource to have also data source tests
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config" | ||
) | ||
|
||
const resourceName = "advanced_cluster" // TODO: if resource exists this can be deleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it's ok to leave it as it helps to know that it has to be removed if resource exists (we get a build error when both constants are defined)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we get a build error when both constants are defined
exactly, that's why personally I don't see value in keeping it. Also, for this one resource does exist already so we have that sorted already no?
As in I don't see anything we need to TODO
here anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I misunderstood, I thought you meant to delete the comment not the full line. It's not usual but happens that we can have a data source but not a resource, in that case this is needed, e.g. control_plane_ip_addresses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you meant to delete the comment
I was referring to delete the comment, yes. My point is since the comment is meant to serve as a guidance during scaffolding. Now that we have the resource and data sources figured out, the comment isn't needed anymore because there's nothing left TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me it's a guide for the tool user, we don't do complex logic yet, so if you have a resource and data source you can see the comment and understand why it's there and delete it, right now we don't have logic to keep the line only if datasource exists
@@ -331,12 +334,36 @@ jobs: | |||
with: | |||
terraform_version: ${{ inputs.terraform_version }} | |||
terraform_wrapper: false | |||
- name: Prepare new advanced_cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nightly tests now will invoke both these advancedcluster groups right?
If so, for a while we might have both tests creating cluster, could that make the Out of capacity issues worse or do you think we have that handled now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think capacity issues are fixed now and this shouldn't be a problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understand are not a problem now, but aren't we doubling the amount of clusters? If so, I'd like to consider alternative solutions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can exclude tests for advancedclulster TPF group from nightly runs and run only in PRs based on change detection in that package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's one option, only run them in PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
var _ datasource.DataSource = &{{.NameCamelCase}}DS{} | ||
var _ datasource.DataSourceWithConfigure = &{{.NameCamelCase}}DS{} | ||
var _ datasource.DataSource = &ds{} | ||
var _ datasource.DataSourceWithConfigure = &ds{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice additional changes to the scaffolding 👍
package advancedcluster | ||
package advancedclusterold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we will have a few months in this state, might prefer leaving existing advanced cluster implementation with advancedcluster
package name and have new implementation with advancedclustertpf
so there is no confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, done in this commit 368c56d
advancedclusterold
package for current implementation and new no-op resourceadvancedclustertpf
package for new implementation
@@ -123,6 +123,8 @@ issues: | |||
- linters: | |||
- gocritic | |||
text: "^hugeParam: req is heavy" | |||
- path: "_schema\\.go" # exclude rules for schema files as it's auto-genereated from OpenAPI spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO: I don't like this change.
At least for now, I prefer doing these manual updates to the schema file and ensure linting passes. Also, I think all of the custom types should be removed.
Later when we introduce re-regenerating in the CI we can change this to be more permissive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are too many changes to do, I've created a ticket to follow it, I hope that's fine: CLOUDP-278408
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work and improvements!
* master: (44 commits) Remove RemoveResource from Create and Update (#2694) sleep first time only (#2696) fix: Ensures event_trigger `disabled` is included in the PUT payload (#2690) chore: Bump srvaroa/labeler from 1.11.0 to 1.11.1 (#2695) build(deps): bump go.mongodb.org/atlas-sdk (#2686) fix: Avoids setting organization id to empty when the USER_IS_NOT_FOUND (#2684) doc: Corrects default value of `auto_scaling_disk_gb_enabled` (#2683) chore: Reminder to log test failures (#2688) chore: Updates CHANGELOG.md for #2670 feat: Supports `config_server_type` and `config_server_management_mode` in advanced_cluster (#2670) chore: Creates `advancedclustertpf` package for new implementation (#2679) chore: Removes deprecation warnings for `labels` in cluster/adv_cluster (#2678) doc: Adjusts `redact_client_log_data` doc (#2676) chore: Adds sleep in tests to avoid out of capacity errors (#2674) refactor: Adjust type of set structure in team update logic (#2675) chore: Updates CHANGELOG.md header for v1.21.1 release chore: Updates examples link in index.md for v1.21.1 release build(deps): bump go.mongodb.org/atlas-sdk (#2672) doc: Fixes Public -> Private Preview and adds contact link. (#2671) chore: Updates CHANGELOG.md for #2669 ...
Description
Creates
advancedclusterold
package for current implementation and new no-op resource.In this way both current and TPF-to-be-built
mongodbatlas_advanced_cluster
versions can co-exist together.advancedcluster
package has the current implementation formongodbatlas_advanced_cluster
advancedclustertpf
has been created as if it was a new resource, using resource and schema scaffoldingadvancedcluster
in this PR is a no-op resource so it can be created and deleted, but doesn't call AtlasImportant commits:
Link to any related issue(s): CLOUDP-278191
Type of change:
Required Checklist:
Further comments