Skip to content

Commit

Permalink
deprecate: Deprecate ip_addresses attribute in project resource and d…
Browse files Browse the repository at this point in the history
…ata source (#2541)

* deprecate ip_addresses attribute in project resource and data source, add UseStateForUnknown workaround

* adjust target removal to 1.21.0

* applying doc review feedback

---------

Co-authored-by: Agustin Bettati <[email protected]>
  • Loading branch information
rubenVB01 and AgustinBettati authored Sep 4, 2024
1 parent a6e0878 commit a3585d0
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .changelog/2541.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:note
resource/mongodbatlas_project: Deprecates the `ip_addresses` attribute. Use the new `mongodbatlas_project_ip_addresses` data source to obtain this information instead.
```

```release-note:note
data-source/mongodbatlas_project: Deprecates the `ip_addresses` attribute. Use the new `mongodbatlas_project_ip_addresses` data source to obtain this information instead.
```

```release-note:note
data-source/mongodbatlas_projects: Deprecates the `ip_addresses` attribute. Use the new `mongodbatlas_project_ip_addresses` data source to obtain this information instead.
```
2 changes: 1 addition & 1 deletion docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ In addition to all arguments above, the following attributes are exported:
* `tags` - Map that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the project. To learn more, see [Resource Tags](https://www.mongodb.com/docs/atlas/tags/)
* `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).
* `ip_addresses` - IP addresses in a project categorized by services. See [IP Addresses](#ip-addresses). **WARNING:** this attribute is deprecated and will be removed in version 1.21.0. Use the `mongodbatlas_project_ip_addresses` data source instead.

* `is_collect_database_specifics_statistics_enabled` - Flag that indicates whether to enable statistics in [cluster metrics](https://www.mongodb.com/docs/atlas/monitor-cluster-metrics/) collection for the project.
* `is_data_explorer_enabled` - Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data "mongodbatlas_projects" "test" {
* `tags` - Map that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the project. To learn more, see [Resource Tags](https://www.mongodb.com/docs/atlas/tags/)
* `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).
* `ip_addresses` - IP addresses in a project categorized by services. See [IP Addresses](#ip-addresses). **WARNING:** this attribute is deprecated and will be removed in version 1.21.0. Use the `mongodbatlas_project_ip_addresses` data source instead.

* `is_collect_database_specifics_statistics_enabled` - Flag that indicates whether to enable statistics in [cluster metrics](https://www.mongodb.com/docs/atlas/monitor-cluster-metrics/) collection for the project.
* `is_data_explorer_enabled` - Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ In addition to all arguments above, the following attributes are exported:
* `id` - The project id.
* `created` - The ISO-8601-formatted timestamp of when Atlas created the project.
* `cluster_count` - The number of Atlas clusters deployed in the project.
* `ip_addresses` - IP addresses in a project categorized by services. See [IP Addresses](#ip-addresses).
* `ip_addresses` - IP addresses in a project categorized by services. See [IP Addresses](#ip-addresses). **WARNING:** this attribute is deprecated and will be removed in version 1.21.0. Use the `mongodbatlas_project_ip_addresses` data source instead.


### IP Addresses
Expand Down
4 changes: 3 additions & 1 deletion internal/service/project/data_source_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
)

Expand Down Expand Up @@ -140,7 +141,8 @@ func (d *projectDS) Schema(ctx context.Context, req datasource.SchemaRequest, re
},
},
"ip_addresses": schema.SingleNestedAttribute{
Computed: true,
Computed: true,
DeprecationMessage: fmt.Sprintf(constant.DeprecationParamByDateWithReplacement, "1.21.0", "mongodbatlas_project_ip_addresses data source"),
Attributes: map[string]schema.Attribute{
"services": schema.SingleNestedAttribute{
Computed: true,
Expand Down
4 changes: 3 additions & 1 deletion internal/service/project/data_source_projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
"go.mongodb.org/atlas-sdk/v20240805003/admin"
Expand Down Expand Up @@ -136,7 +137,8 @@ func (d *ProjectsDS) Schema(ctx context.Context, req datasource.SchemaRequest, r
},
},
"ip_addresses": schema.SingleNestedAttribute{
Computed: true,
Computed: true,
DeprecationMessage: fmt.Sprintf(constant.DeprecationParamByDateWithReplacement, "1.21.0", "mongodbatlas_project_ip_addresses data source"),
Attributes: map[string]schema.Attribute{
"services": schema.SingleNestedAttribute{
Computed: true,
Expand Down
8 changes: 7 additions & 1 deletion internal/service/project/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
)
Expand Down Expand Up @@ -220,7 +222,11 @@ func (r *projectRS) Schema(ctx context.Context, req resource.SchemaRequest, resp
Optional: true,
},
"ip_addresses": schema.SingleNestedAttribute{
Computed: true,
Computed: true,
DeprecationMessage: fmt.Sprintf(constant.DeprecationParamByDateWithReplacement, "1.21.0", "mongodbatlas_project_ip_addresses data source"),
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
},
Attributes: map[string]schema.Attribute{
"services": schema.SingleNestedAttribute{
Computed: true,
Expand Down

0 comments on commit a3585d0

Please sign in to comment.