Skip to content

Commit 1147caa

Browse files
katiexzhangpengq-google
authored andcommitted
Update CustomTargetType resource to include googleCloudBuildRepo type (GoogleCloudPlatform#10543)
1 parent 35fb769 commit 1147caa

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

mmv1/products/clouddeploy/CustomTargetType.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ examples:
7272
primary_resource_name: 'fmt.Sprintf("tf-test-my-custom-target-type%s", context["random_suffix"])'
7373
vars:
7474
custom_target_type_name: "my-custom-target-type"
75+
- !ruby/object:Provider::Terraform::Examples
76+
name: "clouddeploy_custom_target_type_gcb_repo_skaffold_modules"
77+
primary_resource_id: "custom-target-type"
78+
primary_resource_name: 'fmt.Sprintf("tf-test-my-custom-target-type%s", context["random_suffix"])'
79+
vars:
80+
custom_target_type_name: "my-custom-target-type"
7581
parameters:
7682
- !ruby/object:Api::Type::String
7783
name: "location"
@@ -141,6 +147,7 @@ properties:
141147
exactly_one_of:
142148
- git
143149
- googleCloudStorage
150+
- googleCloudBuildRepo
144151
properties:
145152
- !ruby/object:Api::Type::String
146153
name: "repo"
@@ -158,6 +165,7 @@ properties:
158165
exactly_one_of:
159166
- git
160167
- googleCloudStorage
168+
- googleCloudBuildRepo
161169
properties:
162170
- !ruby/object:Api::Type::String
163171
name: "source"
@@ -166,3 +174,21 @@ properties:
166174
- !ruby/object:Api::Type::String
167175
name: "path"
168176
description: "Relative path from the source to the Skaffold file."
177+
- !ruby/object:Api::Type::NestedObject
178+
name: "googleCloudBuildRepo"
179+
description: "Cloud Build 2nd gen repository containing the Skaffold Config modules."
180+
exactly_one_of:
181+
- git
182+
- googleCloudStorage
183+
- googleCloudBuildRepo
184+
properties:
185+
- !ruby/object:Api::Type::String
186+
name: "repository"
187+
description: "Cloud Build 2nd gen repository in the format of 'projects/<project>/locations/<location>/connections/<connection>/repositories/<repository>'."
188+
required: true
189+
- !ruby/object:Api::Type::String
190+
name: "path"
191+
description: "Relative path from the repository root to the Skaffold file."
192+
- !ruby/object:Api::Type::String
193+
name: "ref"
194+
description: "Branch or tag to use when cloning the repository."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" {
2+
location = "us-central1"
3+
name = "<%= ctx[:vars]['custom_target_type_name'] %>"
4+
description = "My custom target type"
5+
custom_actions {
6+
render_action = "renderAction"
7+
deploy_action = "deployAction"
8+
include_skaffold_modules {
9+
configs = ["my-config"]
10+
google_cloud_build_repo {
11+
repository = "projects/example/locations/us-central1/connections/git/repositories/example-repo"
12+
path = "configs/skaffold.yaml"
13+
ref = "main"
14+
}
15+
}
16+
}
17+
}

mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_custom_target_type_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ resource "google_clouddeploy_custom_target_type" "custom-target-type" {
8080
ref = "main"
8181
}
8282
}
83+
include_skaffold_modules {
84+
configs = ["my-config3"]
85+
google_cloud_build_repo {
86+
repository = "projects/example/locations/us-central1/connections/git/repositories/example-repo"
87+
path = "configs/skaffold.yaml"
88+
ref = "main"
89+
}
90+
}
8391
}
8492
}
8593
`, context)

0 commit comments

Comments
 (0)