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

Dialogflow Intent Resource #3285

Merged
merged 5 commits into from
Apr 6, 2020
Merged

Conversation

c2thorn
Copy link
Member

@c2thorn c2thorn commented Mar 23, 2020

Fixes hashicorp/terraform-provider-google#5512

Release Note Template for Downstream PRs (will be copied)

`google_dialogflow_intent`

@c2thorn c2thorn added the upstream Requires an upstream API change/fix label Mar 23, 2020
@modular-magician
Copy link
Collaborator

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(-))
Terraform Beta: Diff ( 5 files changed, 2140 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 1 file changed, 524 insertions(+))
TF OiCS: Diff ( 8 files changed, 262 insertions(+))

@c2thorn c2thorn removed the upstream Requires an upstream API change/fix label Mar 25, 2020
@modular-magician
Copy link
Collaborator

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(-))
Terraform Beta: Diff ( 4 files changed, 1014 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 1 file changed, 154 insertions(+))

@modular-magician
Copy link
Collaborator

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(-))
Terraform Beta: Diff ( 5 files changed, 1026 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 1 file changed, 154 insertions(+))

@c2thorn c2thorn requested a review from chrisst March 30, 2020 17:00
Copy link
Contributor

@chrisst chrisst left a 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]
Copy link
Contributor

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"
Copy link
Contributor

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

products/dialogflow/terraform.yaml Show resolved Hide resolved
name: 'Intent'
base_url: "projects/{{project}}/agent/intents/"
self_link: "{{name}}"
Copy link
Contributor

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}

Copy link
Member Author

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>.

description: |
Indicates whether webhooks are enabled for the intent.
* WEBHOOK_STATE_UNSPECIFIED: Webhook is disabled in the agent and in the intent.
Copy link
Contributor

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.

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.
Copy link
Contributor

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.

Represents different platforms that a rich message can be intended for.
values:
- :PLATFORM_UNSPECIFIED
Copy link
Contributor

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])
Copy link
Contributor

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.

Copy link
Member Author

@c2thorn c2thorn Apr 3, 2020

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

@modular-magician
Copy link
Collaborator

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(-))
Terraform Beta: Diff ( 6 files changed, 1194 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 1 file changed, 154 insertions(+))

@c2thorn c2thorn requested a review from chrisst April 3, 2020 18:59
@modular-magician
Copy link
Collaborator

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(-))
Terraform Beta: Diff ( 6 files changed, 1194 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 1 file changed, 154 insertions(+))

@c2thorn c2thorn merged commit bbaa9fd into GoogleCloudPlatform:master Apr 6, 2020
@c2thorn c2thorn deleted the dialogflow branch April 6, 2020 23:51
nathkn pushed a commit to nathkn/magic-modules that referenced this pull request May 18, 2020
* Dialogflow Intent Resource

* Remove larger fields for simpler reviews

* dialogflow sidebar

* Review changes

* Update id formatting for docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dialogflow Intent Resource
4 participants