Skip to content

Commit

Permalink
azurerm_nginx_deployment: Add dataplane API endpoint property (#28379)
Browse files Browse the repository at this point in the history
- As the property is useful for customers, it is
  worth exposing it as a resource attribute.
- Also updated the data source with the same
  property.
  • Loading branch information
puneetsarna authored Jan 9, 2025
1 parent 33a95a1 commit 4f77fbc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions internal/services/nginx/nginx_deployment_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type DeploymentDataSourceModel struct {
FrontendPrivate []FrontendPrivate `tfschema:"frontend_private"`
NetworkInterface []NetworkInterface `tfschema:"network_interface"`
UpgradeChannel string `tfschema:"automatic_upgrade_channel"`
DataplaneAPIEndpoint string `tfschema:"dataplane_api_endpoint"`
Tags map[string]string `tfschema:"tags"`
}

Expand All @@ -63,6 +64,11 @@ func (m DeploymentDataSource) Attributes() map[string]*pluginsdk.Schema {
Computed: true,
},

"dataplane_api_endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},

"identity": commonschema.SystemOrUserAssignedIdentityComputed(),

"sku": {
Expand Down Expand Up @@ -252,6 +258,7 @@ func (m DeploymentDataSource) Read() sdk.ResourceFunc {
if props := model.Properties; props != nil {
output.IpAddress = pointer.ToString(props.IPAddress)
output.NginxVersion = pointer.ToString(props.NginxVersion)
output.DataplaneAPIEndpoint = pointer.ToString(props.DataplaneApiEndpoint)
output.DiagnoseSupportEnabled = pointer.ToBool(props.EnableDiagnosticsSupport)

if !features.FivePointOhBeta() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestAccNginxDeploymentDataSource_basic(t *testing.T) {
check.That(data.ResourceName).Key("capacity").Exists(),
check.That(data.ResourceName).Key("ip_address").Exists(),
check.That(data.ResourceName).Key("automatic_upgrade_channel").Exists(),
check.That(data.ResourceName).Key("dataplane_api_endpoint").Exists(),
),
},
})
Expand Down
6 changes: 6 additions & 0 deletions internal/services/nginx/nginx_deployment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type DeploymentModel struct {
FrontendPrivate []FrontendPrivate `tfschema:"frontend_private"`
NetworkInterface []NetworkInterface `tfschema:"network_interface"`
UpgradeChannel string `tfschema:"automatic_upgrade_channel"`
DataplaneAPIEndpoint string `tfschema:"dataplane_api_endpoint"`
// Deprecated: remove in next major version
Configuration []Configuration `tfschema:"configuration,removedInNextMajorVersion"`
Tags map[string]string `tfschema:"tags"`
Expand Down Expand Up @@ -277,6 +278,10 @@ func (m DeploymentResource) Attributes() map[string]*pluginsdk.Schema {
Type: pluginsdk.TypeString,
Computed: true,
},
"dataplane_api_endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},
}
}

Expand Down Expand Up @@ -462,6 +467,7 @@ func (m DeploymentResource) Read() sdk.ResourceFunc {
if props := model.Properties; props != nil {
output.IpAddress = pointer.ToString(props.IPAddress)
output.NginxVersion = pointer.ToString(props.NginxVersion)
output.DataplaneAPIEndpoint = pointer.ToString(props.DataplaneApiEndpoint)
output.DiagnoseSupportEnabled = pointer.ToBool(props.EnableDiagnosticsSupport)

if !features.FivePointOhBeta() {
Expand Down
1 change: 1 addition & 0 deletions internal/services/nginx/nginx_deployment_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestAccNginxDeployment_basic(t *testing.T) {
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("capacity").HasValue("10"),
check.That(data.ResourceName).Key("email").HasValue("[email protected]"),
check.That(data.ResourceName).Key("dataplane_api_endpoint").Exists(),
),
},
data.ImportStep(),
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/nginx_deployment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `automatic_upgrade_channel` - The automatic upgrade channel for this NGINX deployment.

* `dataplane_api_endpoint` - The dataplane API endpoint of the NGINX Deployment.

* `tags` - A mapping of tags assigned to the NGINX Deployment.

---
Expand Down
6 changes: 4 additions & 2 deletions website/docs/r/nginx_deployment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `id` - The ID of the NGINX Deployment.

* `ip_address` - The IP address of the deployment.
* `ip_address` - The IP address of the NGINX Deployment.

* `nginx_version` - The version of deployed NGINX.
* `nginx_version` - The version of the NGINX Deployment.

* `dataplane_api_endpoint` - The dataplane API endpoint of the NGINX Deployment.

## Timeouts

Expand Down

0 comments on commit 4f77fbc

Please sign in to comment.