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

Can't easily update DialogflowCX "Default start flow" or "Default welcome intent" #16308

Comments

@mmurakowski-verily
Copy link

mmurakowski-verily commented Oct 19, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

When you create a Dialogflow CX Agent, it automatically creates a DF CX Flow for you; this is the Agent.startFlow; the API docs say "A start flow will be automatically created when the agent is created, and can only be deleted by deleting the agent". Other docs say it'll have "the following flow ID: 00000000-0000-0000-0000-000000000000" i.e. Agent.startFlow will always be projects/<project-id>/locations/<location-id>/agents/<agent-id>/flows/00000000-0000-0000-0000-000000000000

You cannot easily manage this resource in terraform. You have to import it. You know what the terraform import command would look like. You can easily write the import block:

resource "google_dialogflow_cx_agent" "agent" {
  ...
}

import {
  id = google_dialogflow_cx_agent.agent.start_flow
  to = google_dialogflow_cx_flow.default-start-flow
}

resource "google_dialogflow_cx_flow" "default-start-flow" {
  parent = google_dialogflow_cx_agent.agent.id
  ...
}

UNFORTUNATELY, the import block is still pretty dumb; if you write that completely reasonable looking terraform, it errors with

│ Error: Invalid import id argument
│ 
│   on main.tf line 209, in import:
│  209:   id = google_dialogflow_cx_agent.agent.start_flow
│ 
│ The import block "id" argument depends on resource attributes that cannot be determined until apply, so Terraform cannot plan to import this resource.

i.e. there's no one-terraform apply way of managing an Agent + the default start flow. You have to break it into two steps (step 1: apply the agent creation; step 2: import). That's annoying.

Also, even if terraform improves the import block, you're not allowed to delete a default start flow; GCP gives you an error. That's annoying too if you want to remove resources or stop managing stuff.

Same situation for the Default welcome intent, just swap out "intent" for "flow" above.

I wasn't able to find a feature request against terraform itself for improving the import block behavior.

New or Affected Resource(s)

  • google_dialogflow_cx_flow
  • google_dialogflow_cx_intent

Potential Terraform Configuration (implemented in GoogleCloudPlatform/magic-modules#9336)

resource "google_dialogflow_cx_flow" "default-start-flow" {
  is_default_start_flow = true
  ...
}

resource "google_dialogflow_cx_intent" "default-welcome-intent" {
  is_default_welcome_intent = true
  ...
}

Make the is_defult_X fields immutable + not written to the REST API. If they're true, prevent the resource from being created (http POST) or destroyed (http DELETE) and just set the ID to {parent}/flows/00000000-0000-0000-0000-000000000000 or {parent}/intents/00000000-0000-0000-0000-000000000000.

Potential Terraform Configuration (implemented in GoogleCloudPlatform/magic-modules#9359)

resource "google_dialogflow_cx_flow" "default-start-flow" {
  name = "00000000-0000-0000-0000-000000000000"
  ...
}

resource "google_dialogflow_cx_intent" "default-welcome-intent" {
  name = "00000000-0000-0000-0000-000000000000"
  ...
}

Make the name property settable, immutable, and default-from-API. If it's set by the user, PATCH instead of POST and prevent DELETEs.

Potential Terraform Configuration (not implemented yet)

resource "google_dialogflow_cx_default_start_flow" "default-start-flow" {
  ...
}

resource "google_dialogflow_cx_default_welcome_intent" "default-welcome-intent" {
  ...
}

resource "google_dialogflow_cx_default_negative_intent" "default-negative-intent" {
  ...
}

Make three new resources that are hyper-specialized copy-pastes of the existing flow + intent resources. Don't let them POST or DELETE cloud resources.

References

  • #0000

b/307909166

@github-actions github-actions bot added forward/review In review; remove label to forward service/dialogflow labels Oct 19, 2023
@melinath melinath added this to the Goals milestone Oct 23, 2023
@melinath
Copy link
Collaborator

sounds like we'd be going for a "acquire at create time" flow here.

@greese-insight
Copy link

100% with this, I am needing to modify the transition routes (and route groups), and while it is annoying to have to split the work, it's even more annoying that destroy commands don't work. Need to create a new data.dialogflow_cx_default_start_flow element or similar (in fact, we need all the data elements).

SarahFrench added a commit to GoogleCloudPlatform/magic-modules that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (#9336)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp/terraform-provider-google#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb

Co-authored-by: Sarah French <[email protected]>

* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------

Co-authored-by: Sarah French <[email protected]>
modular-magician added a commit to modular-magician/docs-examples that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (#9336)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp/terraform-provider-google#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb

Co-authored-by: Sarah French <[email protected]>

* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------

Co-authored-by: Sarah French <[email protected]>
[upstream:58d0735cfa46a3668a0c5af3181ce6443ab22d91]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to terraform-google-modules/docs-examples that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (#9336) (#589)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp/terraform-provider-google#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb



* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------


[upstream:58d0735cfa46a3668a0c5af3181ce6443ab22d91]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/terraform-provider-google-beta that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (#9336)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp/terraform-provider-google#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb

Co-authored-by: Sarah French <[email protected]>

* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------

Co-authored-by: Sarah French <[email protected]>
[upstream:58d0735cfa46a3668a0c5af3181ce6443ab22d91]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (hashicorp#9336)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb

Co-authored-by: Sarah French <[email protected]>

* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------

Co-authored-by: Sarah French <[email protected]>
[upstream:58d0735cfa46a3668a0c5af3181ce6443ab22d91]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to hashicorp/terraform-provider-google-beta that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (#9336) (#6600)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp/terraform-provider-google#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb



* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------


[upstream:58d0735cfa46a3668a0c5af3181ce6443ab22d91]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit that referenced this issue Nov 3, 2023
… import: `is_default_x` fields (#9336) (#16441)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes #16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb



* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------


[upstream:58d0735cfa46a3668a0c5af3181ce6443ab22d91]

Signed-off-by: Modular Magician <[email protected]>
jialei-chen pushed a commit to jialei-chen/magic-modules that referenced this issue Nov 29, 2023
… import: `is_default_x` fields (GoogleCloudPlatform#9336)

* Enabling management of Default Start Flow + Default Welcome Intent + Default Negative Intent, without terraform import

Fixes hashicorp/terraform-provider-google#16308

* Basic tests for default flow + intents

* Tests asserting resource IDs

* Making Flow + Intent import respect is_default_X; fixing description on examples

* Bah, making isFallback output-only might break users that'd imported the Default Negative Intent :(

* Update mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb

Co-authored-by: Sarah French <[email protected]>

* Adding callout notes about multiple is_default_x resources

* More words around the pre-create + pre-delete code

* Adding more tests around Default Start Flow

* Adding more tests around Default Welcome Intent and Default Negative Intent

---------

Co-authored-by: Sarah French <[email protected]>
Copy link

github-actions bot commented Dec 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.