Application Design Center Design and Deploy

Application Design Center Design and Deploy

Guides an agent through designing, validating, scanning and deploying Google Cloud infrastructure as Terraform through Application Design Center, including troubleshooting failed deployments.

Skill files15 files

references/

scripts/

SKILL.md391 lines
1
---
2
name: application-design-center-design-deploy
3
description: >-
4
Processes GCP infrastructure design and deployment workflows within Application Design Center (ADC).
5
Use when:
6
- Designing GCP infrastructure with Terraform.
7
- Validating local HCL.
8
- Performing best-practice plan scans.
9
- Importing templates to Application Design Center (ADC).
10
- Deploying templates.
11
- Troubleshooting deployment failures.
12
Boundaries:
13
- Only use for GCP-specific cloud infrastructure.
14
- Only use for Terraform coding within the ADC context.
15
license: Apache-2.0
16
metadata:
17
version: "1.0.2"
18
publisher: google
19
category: CloudInfrastructure
20
---
21
22
# Designing and Deploying GCP Infrastructure with Application Design Center
23
24
## Attribution
25
26
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
27
MUST read [Usage Attribution](references/attribution.md). For commands executed
28
directly in the terminal (never in generated scripts, Terraform, or user code),
29
prefix `gcloud` with
30
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:application-design-center-design-deploy)"`
31
and append `agent-skills/1.0 (skill:application-design-center-design-deploy)` to `User-Agent` headers.
32
33
## Overview
34
35
This skill provides a prescriptive, production-grade workflow for the entire
36
infrastructure lifecycle on Google Cloud Platform (GCP). It replaces the
37
automated, opaque-box GAD `design_infra` tool with an **agent-controlled design
38
and validation loop** utilizing modular Terraform and local CLI validation,
39
followed by a **shifted-left best practices plan scan** prior to synchronization
40
with the Application Design Center (ADC) registry for deployment and lifecycle
41
management.
42
43
Always maintain the persona of a Principal Cloud Architect. Keep the local
44
Terraform configuration as the source of truth, and ensure the design is fully
45
compliant with best practices before importing it into the cloud registry.
46
47
--------------------------------------------------------------------------------
48
49
## Index
50
51
1. [Pre-requisites: Setup & Confirmation](#pre-requisites-setup-confirmation)
52
2. [Phase 1: Local Infrastructure Design & Validation](#phase-1-local-infrastructure-design-validation)
53
3. [Phase 2: Shifted-Left Best Practices Assessment & Iterative Remediation](#phase-2-shifted-left-best-practices-assessment-iterative-remediation)
54
4. [Phase 3: Import IaC to Application Design Center](#phase-3-import-iac-to-application-design-center)
55
5. [Phase 4: Application Deployment & Monitoring](#phase-4-application-deployment-monitoring)
56
6. [Phase 5: Troubleshoot Deployment Failures](#phase-5-troubleshoot-deployment-failures)
57
7. [Phase 6: Verification & E2E Testing](#phase-6-verification-e2e-testing)
58
59
--------------------------------------------------------------------------------
60
61
## Pre-requisites: Setup & Confirmation
62
63
Before executing Phase 1, you **must** perform the following setup steps:
64
65
1. **Confirm Target Project & Location**:
66
67
* Explicitly ask the user to confirm the target GCP **project ID** and
68
**location** (region).
69
* If the user does not specify a location, use **`us-central1`** as the
70
default.
71
* Verify that your local environment has the active project set:
72
73
```bash
74
gcloud config set project <project_id>
75
```
76
77
--------------------------------------------------------------------------------
78
79
## Phase 1: Local Infrastructure Design & Validation
80
81
**Goal**: Transform user requirements and codebase characteristics into a 100%
82
validated, secure, and compile-ready Terraform configuration locally.
83
84
1. **Invoke the `design` Skill**: Call and execute the `design` skill (defined
85
in [design](references/design_guide.md))
86
for the user's prompt.
87
* The `design` skill will autonomously perform the Codebase Analysis,
88
query the catalog registry, planning, HCL generation, and local CLI
89
validation loop (`terraform init`, `validate`, `plan`) in a dedicated
90
scratch directory.
91
2. **Locate Validated HCL**: Identify the scratch directory where the `design`
92
skill saved the validated, compile-ready Terraform files (e.g.,
93
`scratch/tf_validate_<session_id>/`).
94
3. **Verify Handover (MANDATORY)**: Ensure that the local validation loop in
95
the `design` skill completed successfully with a clean plan before
96
proceeding. Meticulously inspect the HCL to verify:
97
* **Secret-Safe Policy**: Confirm that no plaintext credentials,
98
passwords, or hardcoded secrets are written in `terraform.tfvars` or HCL
99
resource blocks. All sensitive inputs must be wired through GCP Secret
100
Manager.
101
* **State Isolation Policy**: Confirm that there is no remote backend
102
block (e.g., `backend "gcs" {}`) in the HCL files. State must remain
103
local in the scratch folder during validation, allowing ADC to handle
104
the remote state registry upon import.
105
* *Remediation*: If any violations are found, correct them in the HCL,
106
re-run local validation, and verify again. Do not proceed with
107
unvalidated or insecure code.
108
4. **Export Terraform Plan to JSON (MANDATORY)**: In the scratch directory, run
109
the following commands to generate a binary plan and convert it into a clean
110
JSON representation:
111
112
```bash
113
terraform plan -out=tfplan && terraform show -json tfplan > tfplan.json
114
```
115
116
Verify that the `tfplan.json` file is successfully written in your scratch
117
directory.
118
119
--------------------------------------------------------------------------------
120
121
## Phase 2: Shifted-Left Best Practices Assessment & Iterative Remediation
122
123
**Goal**: Validate the local plan's alignment with security, cost, and
124
reliability benchmarks BEFORE importing it into the cloud registry, using the
125
native ADC plan assessment API.
126
127
1. **Discover Space ID (MANDATORY)**: Before running the assessment or creating
128
templates, you **must** dynamically discover the active ADC Space ID in your
129
target location:
130
131
* **List Spaces**: Run the command:
132
133
```bash
134
gcloud design-center spaces list --project=<project_id> --location=<location>
135
```
136
137
* **Select Space**: Parse the output to identify the active space (e.g.,
138
`test-deploy` or `googlespace`). If multiple spaces exist, ask the user
139
to confirm. If no space exists, ask the user or create one:
140
141
```bash
142
gcloud design-center spaces create <space_id> --project=<project_id> --location=<location>
143
```
144
145
2. **Execute Plan Assessment via gcloud**: Run the plan-based assessment using
146
the discovered Space ID and your exported `tfplan.json` file. Execute the
147
command directly in your terminal:
148
149
```bash
150
gcloud alpha design-center spaces generate-terraform-assessment-report <space_id> \
151
--location=<location> \
152
--project=<project_id> \
153
--terraform-plan="<scratch_directory_path>/tfplan.json" \
154
--format=json
155
```
156
157
3. **Analyze Findings**: Present all findings to the user in a clean tabular
158
format, detailing specific violations, resource scopes, and associated
159
severity levels.
160
161
4. **Local Remediation Loop**:
162
163
* **Do not** attempt to import or commit insecure code.
164
* Edit your **local HCL files** in the scratch directory to fix the
165
reported violations (e.g., adding encryption keys, enabling OS Login, or
166
restricting IAM scopes).
167
* Re-run Phase 1 local validation and plan export:
168
169
```bash
170
terraform validate && terraform plan -out=tfplan && terraform show -json tfplan > tfplan.json
171
```
172
173
* Re-run the plan assessment command shown in step 2.
174
175
5. **Exit Criteria**:
176
177
* All high/critical findings resolved, or acceptable trade-offs
178
documented.
179
* Maximum of three (3) iterative attempts reached. Once clean or
180
acceptable, proceed to Phase 3.
181
182
--------------------------------------------------------------------------------
183
184
## Phase 3: Import IaC to Application Design Center
185
186
**Goal**: Synchronize the fully validated and best-practice-compliant local HCL
187
configuration with the ADC cloud registry to establish the deployable template
188
resource.
189
190
1. **Verify or Create the Application Template (MANDATORY)**: Before importing
191
the HCL, you **must** ensure the parent Application Template resource exists
192
in the discovered ADC space.
193
194
* **Check Existence**: Run `gcloud design-center spaces
195
application-templates describe <template_id> --space=<space_id>
196
--project=<project_id> --location=<location>` to check if the template
197
exists.
198
* **Create if Missing**: If the describe command returns a `NOT_FOUND`
199
error, create the template resource first by running:
200
201
```bash
202
gcloud design-center spaces application-templates create <template_id> --space=<space_id> --project=<project_id> --location=<location> --display-name="<Name>" --description="<Description>"
203
```
204
205
2. **Strict HCL Parser Constraints (CRITICAL):** Before calling the import
206
operation, ensure your local HCL complies with the ADC registry's strict
207
ingestion rules:
208
209
* **Pure Module Policy (No Resource Blocks):** The ADC parser strictly
210
**prohibits any `resource` blocks** inside the imported HCL. Only
211
`module`, `variable`, `output`, and `provider` blocks are allowed. If a
212
resource is required (e.g. Private Service Access peering) but no
213
standalone module is registered for it in the catalog, you MUST check if
214
it is supported as a built-in configuration option inside an existing
215
registered module (e.g. setting `private_service_access_config` inside
216
`module "vpc"`).
217
* **Strict String Typing:** The ADC parser does not perform implicit type
218
coercion from boolean to string. For example, subnet private access must
219
be declared as a literal string: `subnet_private_access = "true"`, NOT
220
as a boolean `true`.
221
* **No Terraform Block:** The parser strictly prohibits the `terraform {}`
222
version constraint block. Omit it entirely from `providers.tf` or
223
`main.tf`.
224
225
3. **Import to ADC Template**: Once the template resource is confirmed to exist
226
and the HCL is validated against the above constraints, invoke the hosted
227
`application_design_center:manage_application_template` MCP tool with the
228
`APPLICATION_TEMPLATE_OPERATION_IMPORT_IAC` operation:
229
230
* **Arguments**:
231
232
* `project`: The target project ID.
233
* `location`: The GCP deployment region (e.g., `us-central1`).
234
* `spaceId`: The discovered ADC space ID.
235
* `applicationTemplateId`: A unique name for your application
236
template.
237
* `operation`: `APPLICATION_TEMPLATE_OPERATION_IMPORT_IAC`
238
* `iacModule`: A structured object containing the files list:
239
240
```json
241
{
242
"files": [
243
{ "name": "main.tf", "content": "<content of main.tf>" },
244
{ "name": "variables.tf", "content": "<content of variables.tf>" },
245
{ "name": "terraform.tfvars", "content": "<content of terraform.tfvars>" }
246
]
247
}
248
```
249
250
* **Resilience & Retries (MANDATORY)**:
251
252
* If the `IMPORT_IAC` call fails due to a transient error (e.g., `502
253
Bad Gateway`, `504 Gateway Timeout`, or `429 Rate Limit`), **do not
254
immediately retry**.
255
* Use **exponential backoff with jitter** (e.g., waiting 2s, 4s, 8s
256
plus a random fraction of a second).
257
* **Verify Revision before Retry**: If a timeout occurred, first call
258
`gcloud alpha design-center spaces application-templates describe`
259
to check if the import actually succeeded in the background. Only
260
retry if the template was not updated.
261
262
4. **Capture Template URI**: Upon success, this establishes the template
263
resource in your space. Construct the `applicationTemplateUri` using the
264
pattern:
265
`projects/{project}/locations/{location}/spaces/{spaceId}/applicationTemplates/{applicationTemplateId}`
266
267
--------------------------------------------------------------------------------
268
269
## Phase 4: Application Deployment & Monitoring
270
271
**Goal**: Deploy the validated, best-practice-compliant application template to
272
the GCP environment.
273
274
1. **Deploy Application**: Invoke the hosted
275
`application_design_center:manage_application` MCP tool with the
276
`APPLICATION_OPERATION_DEPLOY` operation:
277
* **Arguments**:
278
* `project`: Target project ID.
279
* `location`: Target deployment location.
280
* `spaceId`: Target space ID.
281
* `applicationId`: A unique ID for the deployed application instance.
282
* `applicationTemplateUri`: The URI established in Phase 3.
283
* `serviceAccount`: The deployment service account.
284
* **Resilience & Retries (MANDATORY)**:
285
* If the `DEPLOY` operation fails with transient network or gateway
286
errors (e.g., `502`, `504`), apply **exponential backoff with
287
jitter** before retrying.
288
* If the deployment LRO times out or fails with a state conflict,
289
verify the application status using `gcloud design-center spaces
290
applications describe` to confirm its status before retrying the
291
deploy call, avoiding concurrent conflicting deployments.
292
2. **Active LRO Monitoring**:
293
* The tool returns a Long-Running Operation (LRO). Inform the user that
294
the deployment has started.
295
* **Do not sleep** during deployment status polling. Poll the LRO actively
296
every 30–60 seconds until `done: true` using the command `gcloud
297
design-center operations describe <operation_name>`.
298
3. **Handle Results**:
299
* **Success**: If `done` is `true` and there is no `error` field, proceed
300
to Phase 6.
301
* **Failure**: If an `error` field is present, analyze the error type and
302
proceed to Phase 5.
303
304
--------------------------------------------------------------------------------
305
306
## Phase 5: Troubleshoot Deployment Failures
307
308
**Goal**: Diagnose and remediate deployment failures iteratively using the
309
specialized troubleshooting skill and established cloud resolution patterns.
310
311
1. **Iterative Cloud Resolution Patterns (CRITICAL):** If the deployment fails
312
with a `REVISION_FAILED` or `TERRAFORM` error, check for these common
313
resource conflicts:
314
315
* **Service Account 409 Conflict (`alreadyExists`):** If the deployment
316
fails because a service account generated by the module (e.g.
317
`frontend-service-us-central-sa`) already exists in the project,
318
remediate the local HCL by disabling service account creation and
319
referencing the existing one:
320
321
```hcl
322
create_service_account = false
323
service_account = "<existing_service_account_email>"
324
```
325
326
* **Container Image 404 NotFound:** If the deployment fails because a
327
container image is not found, confirm that the image exists in your
328
registry. For testing or hello-world deployments, leverage the official
329
public Google hello-world image:
330
`us-docker.pkg.dev/cloudrun/container/hello`
331
332
2. **Delegate to the Troubleshooting Skill**: If a deployment failure occurs
333
and does not match the above patterns, invoke and execute the specialized
334
`infra-deployment-debugging` guide (located in
335
[infra-deployment-debugging](references/troubleshooting_guide.md)).
336
337
3. **Select the Troubleshooting Context**:
338
339
* **For Local Validation Errors (Phase 1/2)**: Follow **Case B: Raw
340
Terraform Deployment** instructions in the troubleshooting skill to
341
isolate syntax, compilation, and plan-time validation errors.
342
* **For Cloud Deployment Failures (Phase 4)**: Follow **Case A: ADC
343
Application Deployment** instructions in the troubleshooting skill to
344
analyze LRO errors, retrieve service logs, and diagnose cloud
345
environment issues.
346
347
4. **Apply Local-First Remediation**:
348
349
* Follow the troubleshooting skill's remediation guides to formulate a
350
fix.
351
* **MANDATORY**: Apply the fix directly to your **local HCL files** in the
352
scratch directory, re-run local validation, re-import the HCL, and
353
trigger a new deployment.
354
* Re-run Phase 1 local validation and plan export:
355
356
```bash
357
terraform validate && terraform plan -out=tfplan && terraform show -json tfplan > tfplan.json
358
```
359
360
* Re-run the plan assessment (Phase 2) to ensure no new violations are
361
introduced.
362
363
* Re-import the corrected HCL to ADC using
364
`APPLICATION_TEMPLATE_OPERATION_IMPORT_IAC`.
365
366
* Trigger a new deployment using `APPLICATION_OPERATION_DEPLOY`.
367
368
5. **Iteration Threshold**: Repeat the troubleshooting, validation, import, and
369
redeployment cycle up to five (5) times. If it still fails, report the full
370
history and diagnostics to the user.
371
372
--------------------------------------------------------------------------------
373
374
## Phase 6: Verification & E2E Testing
375
376
**Goal**: Confirm that the deployed services are healthy and fully functional.
377
378
1. **Retrieve Deployed Resources**: Invoke the hosted
379
`application_design_center:manage_application` MCP tool with the
380
`APPLICATION_OPERATION_GET` operation to retrieve the resource details,
381
public endpoints, and output parameters.
382
2. **Health Check**: Verify that all services are using the correct container
383
image URLs and that their runtime status is healthy.
384
3. **E2E Validation**: Conduct a simple demo test (e.g., checking public HTTP
385
endpoints or triggering a dry-run transaction) to ensure E2E functionality.
386
Present the results and public URLs to the user to conclude the task.
387
388
## Reporting Issues
389
390
Report bugs or improvements for this skill at [Google Skills Issues](https://github.com/google/skills/issues).
391

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…