Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion mmv1/products/developerconnect/InsightsConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,20 @@ properties:
The name of the App Hub Application.
Format:
projects/{project}/locations/{location}/applications/{application}
required: true
conflicts:
- projects
- name: projects
type: NestedObject
description: The projects to track with the InsightsConfig.
conflicts:
- appHubApplication
properties:
- name: projectIds
type: Array
description: The project IDs. Format {project}.
diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress'
item_type:
type: String
- name: name
type: String
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ resource "google_apphub_application" "my_apphub_application" {
depends_on = [time_sleep.wait_for_propagation]
}

resource "google_developer_connect_insights_config" "insights_config" {
resource "google_developer_connect_insights_config" "insights_config_apphub" {
location = "us-central1"
insights_config_id = "tf-test-ic%{random_suffix}"
insights_config_id = "tf-test-ic-apphub-%{random_suffix}"
project = google_project.project.project_id
annotations = {}
labels = {}
Expand All @@ -133,3 +133,15 @@ resource "google_developer_connect_insights_config" "insights_config" {
}
depends_on = [time_sleep.wait_for_propagation]
}

resource "google_developer_connect_insights_config" "insights_config_projects" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, somehow missed this in the previous reviews. We'd want to target one primary resource per test. Therefore, could you move this to a new test?

location = "us-central1"
insights_config_id = "tf-test-ic-projects-%{random_suffix}"
project = google_project.project.project_id
annotations = {}
labels = {}
projects {
project_ids = ["projects/${google_project.project.project_id}"]
}
depends_on = [time_sleep.wait_for_propagation]
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ func testAccDeveloperConnectInsightsConfig_update(context map[string]interface{}
project = google_project.project.project_id
depends_on = [time_sleep.wait_for_propagation]
}
resource "google_developer_connect_insights_config" "insights_config" {
resource "google_developer_connect_insights_config" "insights_config_apphub" {
location = "us-central1"
insights_config_id = "tf-test-ic%{random_suffix}"
insights_config_id = "tf-test-ic-apphub-%{random_suffix}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is changing the identifier of the resource in the update step which will cause the resource to recreate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

project = google_project.project.project_id
annotations = {}
labels = {}
Expand All @@ -337,5 +337,16 @@ func testAccDeveloperConnectInsightsConfig_update(context map[string]interface{}
}
depends_on = [time_sleep.wait_for_propagation]
}
resource "google_developer_connect_insights_config" "insights_config_projects" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we may want to move this to a new test instead of creating two google_developer_connect_insights_config resources in one test. Or if the resource can update in-place from using app_hub_application to projects, you could add a new test step to update it to use projects.

https://googlecloudplatform.github.io/magic-modules/test/test/#add-resource-tests covers more details on adding tests if it helps.

Let me know if you have any questions, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. I've added a separate test for an insights_config resource created with an AppHub application and another for an insights_config resource created with projectIds.

location = "us-central1"
insights_config_id = "tf-test-ic-projects-%{random_suffix}"
project = google_project.project.project_id
annotations = {}
labels = {}
projects {
project_ids = ["projects/${google_project.project.project_id}"]
}
depends_on = [time_sleep.wait_for_propagation]
}
`, context)
}
Loading