Skip to content

Commit

Permalink
azurerm_mssql_managed_instance : support read-only property `dns_zo…
Browse files Browse the repository at this point in the history
…ne` (#24435)

* support dns_zone for resource azurerm_mssql_managed_instance

* update code
  • Loading branch information
sinbai authored Jan 16, 2024
1 parent e9f8907 commit f228997
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type MsSqlManagedInstanceDataSourceModel struct {
AdministratorLogin string `tfschema:"administrator_login"`
Collation string `tfschema:"collation"`
CustomerManagedKeyId string `tfschema:"customer_managed_key_id"`
DnsZone string `tfschema:"dns_zone"`
DnsZonePartnerId string `tfschema:"dns_zone_partner_id"`
Fqdn string `tfschema:"fqdn"`
Identity []identity.SystemOrUserAssignedList `tfschema:"identity"`
Expand Down Expand Up @@ -86,6 +87,11 @@ func (d MsSqlManagedInstanceDataSource) Attributes() map[string]*pluginsdk.Schem
Computed: true,
},

"dns_zone": {
Type: schema.TypeString,
Computed: true,
},

"dns_zone_partner_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -198,6 +204,9 @@ func (d MsSqlManagedInstanceDataSource) Read() sdk.ResourceFunc {
if props.Collation != nil {
model.Collation = *props.Collation
}
if props.DNSZone != nil {
model.DnsZone = *props.DNSZone
}
if props.KeyID != nil {
model.CustomerManagedKeyId = *props.KeyID
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TestAccDataSourceSqlManagedInstance_basic(t *testing.T) {
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("resource_group_name").Exists(),
check.That(data.ResourceName).Key("tags.%").HasValue("2"),
check.That(data.ResourceName).Key("dns_zone").Exists(),
),
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type MsSqlManagedInstanceModel struct {
AdministratorLoginPassword string `tfschema:"administrator_login_password"`
Collation string `tfschema:"collation"`
DnsZonePartnerId string `tfschema:"dns_zone_partner_id"`
DnsZone string `tfschema:"dns_zone"`
Fqdn string `tfschema:"fqdn"`
Identity []identity.SystemOrUserAssignedList `tfschema:"identity"`
LicenseType string `tfschema:"license_type"`
Expand Down Expand Up @@ -238,6 +239,10 @@ func (r MsSqlManagedInstanceResource) Arguments() map[string]*pluginsdk.Schema {

func (r MsSqlManagedInstanceResource) Attributes() map[string]*pluginsdk.Schema {
return map[string]*pluginsdk.Schema{
"dns_zone": {
Type: schema.TypeString,
Computed: true,
},
"fqdn": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -477,6 +482,9 @@ func (r MsSqlManagedInstanceResource) Read() sdk.ResourceFunc {
if props.Collation != nil {
model.Collation = *props.Collation
}
if props.DNSZone != nil {
model.DnsZone = *props.DNSZone
}
if props.FullyQualifiedDomainName != nil {
model.Fqdn = *props.FullyQualifiedDomainName
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/mssql_managed_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ The following attributes are exported:

* `customer_managed_key` - Specifies KeyVault key, used by SQL Managed Instance for Transparent Data Encryption.

* `dns_zone` - The Dns Zone where the SQL Managed Instance is located.

* `dns_zone_partner_id` - The ID of the SQL Managed Instance which shares the DNS zone.

* `fqdn` - The fully qualified domain name of the Azure Managed SQL Instance.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/mssql_managed_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `id` - The SQL Managed Instance ID.

* `dns_zone` - The Dns Zone where the SQL Managed Instance is located.

* `fqdn` - The fully qualified domain name of the Azure Managed SQL Instance

---
Expand Down

0 comments on commit f228997

Please sign in to comment.