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_mssql_managed_instance : support read-only property dns_zone #24435

Merged
merged 2 commits into from
Jan 16, 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 @@ -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
Loading