Skip to content

Commit

Permalink
Exposing the encryption status of the database
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Aug 30, 2017
1 parent 56d2236 commit 4ae97ab
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions azurerm/resource_arm_sql_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ func resourceArmSqlDatabase() *schema.Resource {
"encryption": {
Type: schema.TypeString,
Computed: true,
// TODO: expose this field
Removed: "This field is now removed.",
},

"creation_date": {
Expand Down Expand Up @@ -302,6 +300,8 @@ func resourceArmSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error
if sddd := props.SourceDatabaseDeletionDate; sddd != nil {
d.Set("source_database_deletion_date", sddd.String())
}

d.Set("encryption", flattenEncryptionStatus(props.TransparentDataEncryption))
}

flattenAndSetTags(d, resp.Tags)
Expand Down Expand Up @@ -336,3 +336,16 @@ func resourceArmSqlDatabaseDelete(d *schema.ResourceData, meta interface{}) erro

return nil
}

func flattenEncryptionStatus(encryption *[]sql.TransparentDataEncryption) string {
if encryption != nil {
encrypted := *encryption
if len(encrypted) > 0 {
if props := encrypted[0].TransparentDataEncryptionProperties; props != nil {
return string(props.Status)
}
}
}

return ""
}

0 comments on commit 4ae97ab

Please sign in to comment.