Skip to content

Commit

Permalink
azurerm_iothub_shared_access_policy - prevent primary_connection_stri…
Browse files Browse the repository at this point in the history
…ng & seconday_connection_string from regenerating (#8017)

fixes #7445

--- PASS: TestAccAzureRMIotHubSharedAccessPolicy_writeWithoutRead (9.74s)
--- PASS: TestAccAzureRMIotHubSharedAccessPolicy_basic (401.00s)
--- PASS: TestAccAzureRMIotHubSharedAccessPolicy_requiresImport (563.10s)
PASS
ok
  • Loading branch information
Neil Ye authored Aug 6, 2020
1 parent 5d0e1d3 commit 53085d2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ func resourceArmIotHubSharedAccessPolicyCreateUpdate(d *schema.ResourceData, met
if features.ShouldResourcesBeImported() && d.IsNewResource() {
return tf.ImportAsExistsError("azurerm_iothub_shared_access_policy", resourceId)
}

if existingAccessPolicy.PrimaryKey != nil {
expandedAccessPolicy.PrimaryKey = existingAccessPolicy.PrimaryKey
}

if existingAccessPolicy.SecondaryKey != nil {
expandedAccessPolicy.SecondaryKey = existingAccessPolicy.SecondaryKey
}

accessPolicies = append(accessPolicies, expandedAccessPolicy)
alreadyExists = true
} else {
Expand Down

0 comments on commit 53085d2

Please sign in to comment.