mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-03 01:01:06 +00:00
Fix order of getting project for storage notification topic (#1490)
* fix getting project for storage notification topic * add more documentation for storage notification topic
This commit is contained in:
parent
612be33ab9
commit
3cc868b4a9
@ -79,13 +79,16 @@ func resourceStorageNotificationCreate(d *schema.ResourceData, meta interface{})
|
||||
|
||||
bucket := d.Get("bucket").(string)
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
topicName := d.Get("topic").(string)
|
||||
computedTopicName := getComputedTopicName("", topicName)
|
||||
if computedTopicName != topicName {
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
computedTopicName = getComputedTopicName(project, topicName)
|
||||
}
|
||||
|
||||
computedTopicName := getComputedTopicName(project, d.Get("topic").(string))
|
||||
|
||||
storageNotification := &storage.Notification{
|
||||
CustomAttributes: expandStringMap(d, "custom_attributes"),
|
||||
EventTypes: convertStringSet(d.Get("event_types").(*schema.Set)),
|
||||
|
@ -44,7 +44,7 @@ resource "google_storage_notification" "notification" {
|
||||
bucket = "${google_storage_bucket.bucket.name}"
|
||||
payload_format = "JSON_API_V1"
|
||||
topic = "${google_pubsub_topic.topic.id}"
|
||||
event_types = ["%s","%s"]
|
||||
event_types = ["OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE"]
|
||||
custom_attributes {
|
||||
new-attribute = "new-attribute-value"
|
||||
}
|
||||
@ -60,7 +60,9 @@ The following arguments are supported:
|
||||
|
||||
* `payload_format` - (Required) The desired content of the Payload. One of `"JSON_API_V1"` or `"NONE"`.
|
||||
|
||||
* `topic` - (Required) The Cloud PubSub topic to which this subscription publishes.
|
||||
* `topic` - (Required) The Cloud PubSub topic to which this subscription publishes. Expects either the
|
||||
topic name, assumed to belong to the default GCP provider project, or the project-level name,
|
||||
i.e. `projects/my-gcp-project/topics/my-topic` or `my-topic`.
|
||||
|
||||
- - -
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user