Skip to content

Commit

Permalink
Populate access keys to SignalR service (#2506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Junyi Yi committed Jan 12, 2019
1 parent 5fa2b89 commit 45efb4e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions azurerm/resource_arm_signalr_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,30 @@ func resourceArmSignalRService() *schema.Resource {
Computed: true,
},

"primary_access_key": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},

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

"secondary_access_key": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},

"secondary_connection_string": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},

"tags": tagsSchema(),
},
}
Expand Down Expand Up @@ -143,6 +167,11 @@ func resourceArmSignalRServiceRead(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Error getting SignalR %q (Resource Group %q): %+v", name, resourceGroup, err)
}

keys, err := client.ListKeys(ctx, resourceGroup, name)
if err != nil {
return fmt.Errorf("Error getting keys of SignalR %q (Resource Group %q): %+v", name, resourceGroup, err)
}

d.Set("name", name)
d.Set("resource_group_name", resourceGroup)
if location := resp.Location; location != nil {
Expand All @@ -160,6 +189,11 @@ func resourceArmSignalRServiceRead(d *schema.ResourceData, meta interface{}) err
d.Set("server_port", properties.ServerPort)
}

d.Set("primary_access_key", keys.PrimaryKey)
d.Set("primary_connection_string", keys.PrimaryConnectionString)
d.Set("secondary_access_key", keys.SecondaryKey)
d.Set("secondary_connection_string", keys.SecondaryConnectionString)

flattenAndSetTags(d, resp.Tags)

return nil
Expand Down

0 comments on commit 45efb4e

Please sign in to comment.