-
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
feat: Adds new ip_addresses
computed attribute in mongodbatlas_project
resource and data sources
#1850
Conversation
ip_addresses
computed attributed in mongodbatlas_project
resource and data sources
ip_addresses
computed attributed in mongodbatlas_project
resource and data sourcesip_addresses
computed attribute in mongodbatlas_project
resource and data sources
@@ -6,12 +6,18 @@ filename: "{{ .InterfaceName | snakecase }}.go" | |||
mockname: "{{.InterfaceName}}" | |||
|
|||
packages: | |||
? github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchdeployment |
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.
mockery config file was not working as expected, only the last package (in this case advancedcluster
) was used for generating mocks.
...rvice/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers.go
Outdated
Show resolved
Hide resolved
* `teams` - Returns all teams to which the authenticated user has access in the project. See [Teams](#teams). | ||
* `limits` - The limits for the specified project. See [Limits](#limits). | ||
* `ip_addresses` - IP addresses in a project categorized by services. See [IP Addresses](#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.
Adjusting format of defining nested schema in other section, generates consistency with project resource documentation and how tfplugindocs also defines nested schemas.
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!
@@ -137,12 +138,40 @@ func (d *projectDS) Schema(ctx context.Context, req datasource.SchemaRequest, re | |||
}, | |||
}, | |||
}, | |||
"ip_addresses": schema.SingleNestedAttribute{ |
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.
can something be used from project_ip_access_list resource/ds or they're different concepts?
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.
They seem to be different concepts. From testing I can see that it provides the IP address of each cluster node. This scope document gives some more details as to users that would leverage these ip addresses
@@ -134,6 +134,34 @@ func (d *ProjectsDS) Schema(ctx context.Context, req datasource.SchemaRequest, r | |||
}, | |||
}, | |||
}, | |||
"ip_addresses": schema.SingleNestedAttribute{ |
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.
can some part of the schema be reused from the RS or it's hard because here all are Computed?
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 main limitation is that they are different schema types, terraform-plugin-framework/datasource/schema
and terraform-plugin-framework/resource/schema
respectively.
@@ -137,12 +138,40 @@ func (d *projectDS) Schema(ctx context.Context, req datasource.SchemaRequest, re | |||
}, | |||
}, | |||
}, | |||
"ip_addresses": schema.SingleNestedAttribute{ | |||
Attributes: map[string]schema.Attribute{ | |||
"services": schema.SingleNestedAttribute{ |
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.
what is services adding as opposed to not having it?
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.
Here I am sticking to the structure defined in the API. From the scope doc:
We will design the API schema in a way that's extensible (similar to the way SRE is designing theirs) so we can just add the bare minimum for now and future projects can add more.
I believe sticking to this structure will avoid breaking changes in the future as more services are added. Also synced with Zuhair on this in the jira comments.
"services": schema.SingleNestedAttribute{ | ||
Attributes: map[string]schema.Attribute{ | ||
"clusters": schema.ListNestedAttribute{ | ||
NestedObject: schema.NestedAttributeObject{ |
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.
it seems like IP addresses are associated to clusters in the project? wouldn't it make more sense then that IP addresses are returned in the clustest/adv_cluster resource instead of project? or in addition to be returned in project?
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.
This a fair point. The main reason I see for including in the project resource is due to the endpoint being tagged in the project section (https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Projects/operation/returnAllIPAddresses).
{ | ||
TeamID: types.StringValue("teamId"), | ||
RoleNames: roleList, | ||
}, | ||
} | ||
teamsTFSet, _ = types.SetValueFrom(context.Background(), project.TfTeamObjectType, []project.TFTeamModel{ |
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.
shouldn't we check errors or it's ok because it's in tests?
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.
not concerned for creating the test value, however adjusted model functions to return diags and check in the unit tests that no errors are encountered.
Co-authored-by: Leo Antoli <[email protected]>
3d0a4a5
to
a857967
Compare
Description
Link to any related issue(s): CLOUDP-215106
Includes new computed attribute
ip_addresses
in project resource and data sources.Resulting terraform state for a project with no clusters
Resulting terraform state for a project with clusters
(IP values obfuscated manually)
Type of change:
Required Checklist:
Further comments