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_media_streaming_endpoint support Standard Streaming Endpoint #16304

Merged
merged 1 commit into from
Apr 8, 2022
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 @@ -67,7 +67,7 @@ func resourceMediaStreamingEndpoint() *pluginsdk.Resource {
"scale_units": {
Type: pluginsdk.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(1, 10),
ValidateFunc: validation.IntBetween(0, 10),
},

"access_control": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ func TestAccMediaStreamingEndpoint_shouldStopWhenStarted(t *testing.T) {
})
}

func TestAccMediaStreamingEndpoint_standard(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_media_streaming_endpoint", "test")
r := MediaStreamingEndpointResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.standard(data),
Check: acceptance.ComposeAggregateTestCheckFunc(
check.That(data.ResourceName).Key("scale_units").HasValue("0"),
),
},
data.ImportStep(),
})
}

func (r MediaStreamingEndpointResource) Start(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) error {
id, err := parse.StreamingEndpointID(state.ID)
if err != nil {
Expand Down Expand Up @@ -175,6 +190,19 @@ resource "azurerm_media_streaming_endpoint" "test" {
`, r.template(data))
}

func (r MediaStreamingEndpointResource) standard(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "azurerm_media_streaming_endpoint" "test" {
name = "endpoint1"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
media_services_account_name = azurerm_media_services_account.test.name
scale_units = 0
}
`, r.template(data))
}

func (MediaStreamingEndpointResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/media_streaming_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The following arguments are supported:

* `resource_group_name` - (Required) The name of the Resource Group where the Streaming Endpoint should exist. Changing this forces a new Streaming Endpoint to be created.

* `scale_units` - (Required) The number of scale units.
* `scale_units` - (Required) The number of scale units. To create a Standard Streaming Endpoint set 0. For Premium Streaming Endpoint valid values are between 1 and 10.

---

Expand Down