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_eventgrid_event_subscription - deprecate topic_name #7871

Merged
merged 2 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -87,9 +87,10 @@ func resourceArmEventGridEventSubscription() *schema.Resource {
},

"topic_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Deprecated: "This field has been updated to readonly field since Apr 25, 2019. So remove this unnecessary field.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Deprecated: "This field has been updated to readonly field since Apr 25, 2019. So remove this unnecessary field.",
Deprecated: "This field has been updated to readonly field since Apr 25, 2019 so no longer has any affect and will be removed in version 3.0 of the provider.",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. thx

},

"azure_function_endpoint": {
Expand Down Expand Up @@ -673,10 +674,6 @@ func resourceArmEventGridEventSubscriptionRead(d *schema.ResourceData, meta inte

d.Set("event_delivery_schema", string(props.EventDeliverySchema))

if props.Topic != nil && *props.Topic != "" {
d.Set("topic_name", props.Topic)
}

if azureFunctionEndpoint, ok := props.Destination.AsAzureFunctionEventSubscriptionDestination(); ok {
if err := d.Set("azure_function_endpoint", flattenEventGridEventSubscriptionAzureFunctionEndpoint(azureFunctionEndpoint)); err != nil {
return fmt.Errorf("Error setting `%q` for EventGrid Event Subscription %q (Scope %q): %s", "azure_function_endpoint", id.Name, id.Scope, err)
Expand Down
59 changes: 59 additions & 0 deletions examples/eventgrid/event-subscription/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "example" {
name = "${var.prefix}-resources"
location = var.location
}

resource "azurerm_storage_account" "example" {
name = "${var.prefix}sa"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}

resource "azurerm_storage_queue" "example" {
name = "${var.prefix}-sq"
storage_account_name = azurerm_storage_account.example.name
}

resource "azurerm_storage_container" "example" {
name = "vhds"
storage_account_name = azurerm_storage_account.example.name
container_access_type = "private"
}

resource "azurerm_storage_blob" "example" {
name = "herpderp1.vhd"

storage_account_name = azurerm_storage_account.example.name
storage_container_name = azurerm_storage_container.example.name

type = "Page"
size = 5120
}

resource "azurerm_eventgrid_event_subscription" "example" {
name = "${var.prefix}-eventsubs"
scope = azurerm_resource_group.example.id

storage_queue_endpoint {
storage_account_id = azurerm_storage_account.example.id
queue_name = azurerm_storage_queue.example.name
}

storage_blob_dead_letter_destination {
storage_account_id = azurerm_storage_account.example.id
storage_blob_container_name = azurerm_storage_container.example.name
}

retry_policy {
event_time_to_live = 11
max_delivery_attempts = 11
}

labels = ["test", "test1", "test2"]
}
7 changes: 7 additions & 0 deletions examples/eventgrid/event-subscription/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "prefix" {
description = "The Prefix used for all resources in this example"
}

variable "location" {
description = "The Azure Region in which all resources in this example should be created."
}
2 changes: 1 addition & 1 deletion website/docs/r/eventgrid_event_subscription.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The following attributes are exported:

* `id` - The ID of the EventGrid Event Subscription.

* `topic_name` - (Optional) Specifies the name of the topic to associate with the event subscription.
* `topic_name` - (Optional/ **Deprecated) Specifies the name of the topic to associate with the event subscription.

## Timeouts

Expand Down