mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +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,12 +79,15 @@ func resourceStorageNotificationCreate(d *schema.ResourceData, meta interface{})
|
|||||||
|
|
||||||
bucket := d.Get("bucket").(string)
|
bucket := d.Get("bucket").(string)
|
||||||
|
|
||||||
|
topicName := d.Get("topic").(string)
|
||||||
|
computedTopicName := getComputedTopicName("", topicName)
|
||||||
|
if computedTopicName != topicName {
|
||||||
project, err := getProject(d, config)
|
project, err := getProject(d, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
computedTopicName = getComputedTopicName(project, topicName)
|
||||||
computedTopicName := getComputedTopicName(project, d.Get("topic").(string))
|
}
|
||||||
|
|
||||||
storageNotification := &storage.Notification{
|
storageNotification := &storage.Notification{
|
||||||
CustomAttributes: expandStringMap(d, "custom_attributes"),
|
CustomAttributes: expandStringMap(d, "custom_attributes"),
|
||||||
|
@ -44,7 +44,7 @@ resource "google_storage_notification" "notification" {
|
|||||||
bucket = "${google_storage_bucket.bucket.name}"
|
bucket = "${google_storage_bucket.bucket.name}"
|
||||||
payload_format = "JSON_API_V1"
|
payload_format = "JSON_API_V1"
|
||||||
topic = "${google_pubsub_topic.topic.id}"
|
topic = "${google_pubsub_topic.topic.id}"
|
||||||
event_types = ["%s","%s"]
|
event_types = ["OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE"]
|
||||||
custom_attributes {
|
custom_attributes {
|
||||||
new-attribute = "new-attribute-value"
|
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"`.
|
* `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