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

azurerm_notification_hub_authorization_rule - add primary_connection_string and secondary_connection_string computed attributes #26188

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down Expand Up @@ -83,13 +84,27 @@ func resourceNotificationHubAuthorizationRule() *pluginsdk.Resource {
},

"primary_access_key": {
Type: pluginsdk.TypeString,
Computed: true,
Type: pluginsdk.TypeString,
Computed: true,
Sensitive: features.FourPointOhBeta(),
},

"secondary_access_key": {
Type: pluginsdk.TypeString,
Computed: true,
Type: pluginsdk.TypeString,
Computed: true,
Sensitive: features.FourPointOhBeta(),
},

"primary_connection_string": {
Type: pluginsdk.TypeString,
Computed: true,
Sensitive: true,
},

"secondary_connection_string": {
Type: pluginsdk.TypeString,
Computed: true,
Sensitive: true,
},
},
}
Expand Down Expand Up @@ -181,6 +196,8 @@ func resourceNotificationHubAuthorizationRuleRead(d *pluginsdk.ResourceData, met
if keysModel := keysResp.Model; keysModel != nil {
d.Set("primary_access_key", keysModel.PrimaryKey)
d.Set("secondary_access_key", keysModel.SecondaryKey)
d.Set("primary_connection_string", keysModel.PrimaryConnectionString)
d.Set("secondary_connection_string", keysModel.SecondaryConnectionString)
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func TestAccNotificationHubAuthorizationRule_listen(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
),
},
data.ImportStep(),
Expand All @@ -50,6 +52,8 @@ func TestAccNotificationHubAuthorizationRule_requiresImport(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
),
},
data.RequiresImportErrorStep(r.requiresImport),
Expand All @@ -69,6 +73,8 @@ func TestAccNotificationHubAuthorizationRule_manage(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
),
},
data.ImportStep(),
Expand All @@ -88,6 +94,8 @@ func TestAccNotificationHubAuthorizationRule_send(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
),
},
data.ImportStep(),
Expand All @@ -110,18 +118,24 @@ func TestAccNotificationHubAuthorizationRule_multi(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
check.That("azurerm_notification_hub_authorization_rule.test2").ExistsInAzure(r),
check.That(resourceTwoName).Key("manage").HasValue("false"),
check.That(resourceTwoName).Key("send").HasValue("true"),
check.That(resourceTwoName).Key("listen").HasValue("true"),
check.That(resourceTwoName).Key("primary_access_key").Exists(),
check.That(resourceTwoName).Key("secondary_access_key").Exists(),
check.That(resourceTwoName).Key("primary_connection_string").Exists(),
check.That(resourceTwoName).Key("secondary_connection_string").Exists(),
check.That("azurerm_notification_hub_authorization_rule.test3").ExistsInAzure(r),
check.That(resourceThreeName).Key("manage").HasValue("false"),
check.That(resourceThreeName).Key("send").HasValue("true"),
check.That(resourceThreeName).Key("listen").HasValue("true"),
check.That(resourceThreeName).Key("primary_access_key").Exists(),
check.That(resourceThreeName).Key("secondary_access_key").Exists(),
check.That(resourceThreeName).Key("primary_connection_string").Exists(),
check.That(resourceThreeName).Key("secondary_connection_string").Exists(),
),
},
data.ImportStep(),
Expand All @@ -143,6 +157,8 @@ func TestAccNotificationHubAuthorizationRule_updated(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
),
},
{
Expand All @@ -154,6 +170,8 @@ func TestAccNotificationHubAuthorizationRule_updated(t *testing.T) {
check.That(data.ResourceName).Key("listen").HasValue("true"),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
),
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `secondary_access_key` - The Secondary Access Key associated with this Authorization Rule.

* `primary_connection_string` - The Primary Connetion String associated with this Authorization Rule.

* `secondary_connection_string` - The Secondary Connetion String associated with this Authorization Rule.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
Expand Down
Loading