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

azure_communication_service adding property hostname (resource and data source) #28620

Merged
merged 1 commit into from
Jan 30, 2025
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 @@ -31,6 +31,7 @@ type CommunicationServiceDataSourceModel struct {
SecondaryConnectionString string `tfschema:"secondary_connection_string"`
SecondaryKey string `tfschema:"secondary_key"`
Tags map[string]string `tfschema:"tags"`
HostName string `tfschema:"hostname"`
}

func (CommunicationServiceDataSource) Arguments() map[string]*pluginsdk.Schema {
Expand Down Expand Up @@ -77,6 +78,11 @@ func (CommunicationServiceDataSource) Attributes() map[string]*pluginsdk.Schema
},

"tags": commonschema.TagsDataSource(),

"hostname": {
Type: pluginsdk.TypeString,
Computed: true,
},
}
}

Expand Down Expand Up @@ -114,6 +120,7 @@ func (CommunicationServiceDataSource) Read() sdk.ResourceFunc {
if model := resp.Model; model != nil {
if props := model.Properties; props != nil {
state.DataLocation = props.DataLocation
state.HostName = pointer.From(props.HostName)
}

state.Tags = pointer.From(model.Tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestAccCommunicationServiceDataSource_basic(t *testing.T) {
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
check.That(data.ResourceName).Key("primary_key").Exists(),
check.That(data.ResourceName).Key("secondary_key").Exists(),
check.That(data.ResourceName).Key("hostname").Exists(),
),
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type CommunicationServiceResourceModel struct {
SecondaryConnectionString string `tfschema:"secondary_connection_string"`
PrimaryKey string `tfschema:"primary_key"`
SecondaryKey string `tfschema:"secondary_key"`
HostName string `tfschema:"hostname"`
}

func (CommunicationServiceResource) StateUpgraders() sdk.StateUpgradeData {
Expand Down Expand Up @@ -115,6 +116,11 @@ func (CommunicationServiceResource) Attributes() map[string]*pluginsdk.Schema {
Computed: true,
Sensitive: true,
},

"hostname": {
Type: pluginsdk.TypeString,
Computed: true,
},
}
}

Expand Down Expand Up @@ -246,6 +252,7 @@ func (CommunicationServiceResource) Read() sdk.ResourceFunc {
if model := resp.Model; model != nil {
if props := model.Properties; props != nil {
state.DataLocation = props.DataLocation
state.HostName = pointer.From(props.HostName)
}

state.Tags = pointer.From(model.Tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestAccCommunicationService_complete(t *testing.T) {
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
check.That(data.ResourceName).Key("primary_key").Exists(),
check.That(data.ResourceName).Key("secondary_key").Exists(),
check.That(data.ResourceName).Key("hostname").Exists(),
),
},
data.ImportStep(),
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/communication_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `tags` - A mapping of tags assigned to the Communication Service.

* `hostname` - The hostname of the Communication Service

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/communication_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ In addition to the Arguments listed above - the following Attributes are exporte
* `secondary_connection_string` - The secondary connection string of the Communication Service.
* `primary_key` - The primary key of the Communication Service.
* `secondary_key` - The secondary key of the Communication Service.
* `hostname` - The hostname of the Communication Service

## Timeouts

Expand Down
Loading