-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Dialogflow Intent Resource #3285
Conversation
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 2140 insertions(+), 2 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 1014 insertions(+), 2 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 1026 insertions(+), 2 deletions(-)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have questions around the 'name' and the import flow, the rest is minor stuff.
project = google_project_service.agent_project.project | ||
role = "roles/dialogflow.admin" | ||
member = "serviceAccount:service-${google_project.agent_project.number}@gcp-sa-dialogflow.iam.gserviceaccount.com" | ||
depends_on = [google_project_service.agent_project] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed because when you interpolate a value anywhere in this resource from an upstream resource (eg project = google_project_service.agent_project.project
) the dependency is added implicitly.
} | ||
|
||
resource "google_dialogflow_agent" "agent" { | ||
project = "%s" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use interpolation here instead of string replacement
name: 'Intent' | ||
base_url: "projects/{{project}}/agent/intents/" | ||
self_link: "{{name}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused what the value of 'name' is. I assumed based on the import format of "projects/{{project}}/agent/intents/{{name}}"
that name would just be a uuid or some such unique identifier. But if that is the case then I don't think the self_link is https://dialogflow.googleapis.com/v2/{{a unique id}}
fyi I think by default self_link is {{base_url}}/{{name}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, that import format line was outdated and ignored because of the custom import. name
here returns from the API in the format of projects/<Project ID>/agent/intents/<Intent ID>
which is the same as the self_link
. The API doesn't have a field for just <Intent ID>
.
products/dialogflow/api.yaml
Outdated
description: | | ||
Indicates whether webhooks are enabled for the intent. | ||
* WEBHOOK_STATE_UNSPECIFIED: Webhook is disabled in the agent and in the intent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually protobufs require that there is a default for all enums which is "blah_blah_unspecified". This is to guard against bugs where somebody forgot to actually set the value for the enum and is very rarely an acceptable value for the enum. If the API does not accept the unspecified value we usually strip it from the values we present to the user.
products/dialogflow/api.yaml
Outdated
description: | | ||
The collection of event names that trigger the intent. If the collection of input contexts is not empty, all of | ||
the contexts must be present in the active user session for an event to trigger this intent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this completely unstructured or are there only certain events that the API will accept? It might help to link to a page that describes what 'events' are in this context.
products/dialogflow/api.yaml
Outdated
Represents different platforms that a rich message can be intended for. | ||
values: | ||
- :PLATFORM_UNSPECIFIED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as unspecified enums above.
) | ||
} | ||
|
||
d.Set("project", stringParts[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually you only need to set the id of a resource and the subsequent get should be able to read the rest. If the 'name' is the equivalent of the self_link then you should be able to just set the id to the name without needing to parse the project from the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we are overwriting the part that would normally parse the project. We need to use a custom import like index_self_link_as_name_set_project.go.erb, except for just the project field
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 6 files changed, 1194 insertions(+), 2 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 6 files changed, 1194 insertions(+), 2 deletions(-)) |
* Dialogflow Intent Resource * Remove larger fields for simpler reviews * dialogflow sidebar * Review changes * Update id formatting for docs
Fixes hashicorp/terraform-provider-google#5512
Release Note Template for Downstream PRs (will be copied)