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

Promote Cloud Deploy Automation to GA #10043

Merged
merged 23 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fe90069
Add Cloud Deploy Automation
ChrisGe4 Nov 30, 2023
a4e46eb
Merge branch 'GoogleCloudPlatform:main' into main
ChrisGe4 Dec 1, 2023
83ca39a
Attempt to solve the test errors based on https://yaqs.corp.google.co…
ChrisGe4 Dec 1, 2023
96aede3
Merge branch 'main' of https://github.com/ChrisGe4/magic-modules
ChrisGe4 Dec 1, 2023
5d8636a
Add update test for the new automation resource
ChrisGe4 Dec 1, 2023
2e4bb80
fix lint errors
ChrisGe4 Dec 1, 2023
a24cfd7
fix lint errors
ChrisGe4 Dec 1, 2023
61e2ca6
fix errors in GA provider test
ChrisGe4 Dec 1, 2023
34213da
add the missing test
ChrisGe4 Dec 1, 2023
3e3cff0
add a full test
ChrisGe4 Dec 4, 2023
c9d2252
Attempt to fix the acceptance test errors
ChrisGe4 Dec 5, 2023
bfef875
fix a lint error
ChrisGe4 Dec 5, 2023
0fd12b4
mark labels as default_from_api:true
ChrisGe4 Dec 5, 2023
1f209c5
fix advance rollout rule definition
ChrisGe4 Dec 5, 2023
011cc67
Mark service_account as 'ignore_read: true'
ChrisGe4 Dec 8, 2023
47a1d2a
Fix test errors
ChrisGe4 Dec 12, 2023
6eff50a
Resolve review comments
ChrisGe4 Dec 19, 2023
d774fd3
Format test file
ChrisGe4 Dec 27, 2023
81dc09c
Merge branch 'main' of https://github.com/ChrisGe4/magic-modules
ChrisGe4 Feb 23, 2024
f936d39
promote google_clouddeploy_automation to GA
ChrisGe4 Feb 23, 2024
e5b4b52
promote google_clouddeploy_automation to GA
ChrisGe4 Feb 23, 2024
6d4c301
Merge branch 'main' of https://github.com/ChrisGe4/magic-modules
ChrisGe4 Feb 23, 2024
cff0e8e
fix lint errors
ChrisGe4 Feb 26, 2024
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
5 changes: 2 additions & 3 deletions mmv1/products/clouddeploy/Automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ references: !ruby/object:Api::Resource::ReferenceLinks
api: 'https://cloud.google.com/deploy/docs/api/reference/rest/v1/projects.locations.deliveryPipelines.automations'
base_url: 'projects/{{project}}/locations/{{location}}/deliveryPipelines/{{delivery_pipeline}}/automations'
self_link: 'projects/{{project}}/locations/{{location}}/deliveryPipelines/{{delivery_pipeline}}/automations/{{name}}'
min_version: beta

create_url: 'projects/{{project}}/locations/{{location}}/deliveryPipelines/{{delivery_pipeline}}/automations?automationId={{name}}'
update_verb: :PATCH
update_mask: true
Expand Down Expand Up @@ -51,7 +51,6 @@ autogen_async: true
examples:
- !ruby/object:Provider::Terraform::Examples
name: "clouddeploy_automation_basic"
min_version: beta
primary_resource_id: "b-automation"
vars:
automation: "cd-automation"
Expand All @@ -60,7 +59,7 @@ examples:
service_account: :SERVICE_ACCT
- !ruby/object:Provider::Terraform::Examples
name: "clouddeploy_automation_full"
min_version: beta

primary_resource_id: "f-automation"
vars:
automation: "cd-automation"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
name = "<%= ctx[:vars]['automation'] %>"
project = google_clouddeploy_delivery_pipeline.pipeline.project
location = google_clouddeploy_delivery_pipeline.pipeline.location
Expand All @@ -19,7 +18,6 @@ resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" {
}

resource "google_clouddeploy_delivery_pipeline" "pipeline" {
provider = google-beta
name = "<%= ctx[:vars]['delivery_pipeline'] %>"
location = "us-central1"
serial_pipeline {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
name = "<%= ctx[:vars]['automation'] %>"
location = "us-central1"
delivery_pipeline = google_clouddeploy_delivery_pipeline.pipeline.name
Expand Down Expand Up @@ -40,7 +39,6 @@ resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" {
}

resource "google_clouddeploy_delivery_pipeline" "pipeline" {
provider = google-beta
name = "<%= ctx[:vars]['delivery_pipeline'] %>"
location = "us-central1"
serial_pipeline {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,52 @@
<% autogen_exception -%>
package clouddeploy_test


<% unless version == 'ga' -%>
import (
"testing"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"

"github.com/hashicorp/terraform-provider-google/google/acctest"
"github.com/hashicorp/terraform-provider-google/google/envvar"
"github.com/hashicorp/terraform-provider-google/google/acctest"
"github.com/hashicorp/terraform-provider-google/google/envvar"
)

func TestAccClouddeployAutomation_update(t *testing.T) {
t.Parallel()
t.Parallel()

context := map[string]interface{}{
"service_account": envvar.GetTestServiceAccountFromEnv(t),
"random_suffix": acctest.RandString(t, 10),
}
context := map[string]interface{}{
"service_account": envvar.GetTestServiceAccountFromEnv(t),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
CheckDestroy: testAccCheckClouddeployAutomationDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccClouddeployAutomation_basic(context),
},
{
ResourceName: "google_clouddeploy_automation.automation",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "delivery_pipeline", "annotations", "labels", "terraform_labels"},
},
{
Config: testAccClouddeployAutomation_update(context),
},
{
ResourceName: "google_clouddeploy_automation.automation",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "delivery_pipeline", "annotations", "labels", "terraform_labels"},
},
},
})
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckClouddeployAutomationDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccClouddeployAutomation_basic(context),
},
{
ResourceName: "google_clouddeploy_automation.automation",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "delivery_pipeline", "annotations", "labels", "terraform_labels"},
},
{
Config: testAccClouddeployAutomation_update(context),
},
{
ResourceName: "google_clouddeploy_automation.automation",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "delivery_pipeline", "annotations", "labels", "terraform_labels"},
},
},
})
}

func testAccClouddeployAutomation_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
return acctest.Nprintf(`
resource "google_clouddeploy_automation" "automation" {
provider = google-beta
name = "tf-test-cd-automation%{random_suffix}"
location = "us-central1"
delivery_pipeline = google_clouddeploy_delivery_pipeline.pipeline.name
Expand All @@ -71,7 +67,6 @@ resource "google_clouddeploy_automation" "automation" {
}

resource "google_clouddeploy_delivery_pipeline" "pipeline" {
provider = google-beta
name = "tf-test-cd-pipeline%{random_suffix}"
location = "us-central1"
serial_pipeline {
Expand All @@ -85,10 +80,9 @@ resource "google_clouddeploy_delivery_pipeline" "pipeline" {
}

func testAccClouddeployAutomation_update(context map[string]interface{}) string {
return acctest.Nprintf(`
return acctest.Nprintf(`

resource "google_clouddeploy_automation" "automation" {
provider = google-beta
name = "tf-test-cd-automation%{random_suffix}"
location = "us-central1"
delivery_pipeline = google_clouddeploy_delivery_pipeline.pipeline.name
Expand Down Expand Up @@ -129,7 +123,6 @@ resource "google_clouddeploy_automation" "automation" {
}

resource "google_clouddeploy_delivery_pipeline" "pipeline" {
provider = google-beta
name = "tf-test-cd-pipeline%{random_suffix}"
location = "us-central1"
serial_pipeline {
Expand All @@ -141,5 +134,3 @@ resource "google_clouddeploy_delivery_pipeline" "pipeline" {
}
`, context)
}
<% end -%>

Loading