이 페이지에서는 배포를 만들기 전 구성 파일 미리보기 방법을 설명합니다. 구성에 대해 자세히 알아보려면 구성 개요를 참조하세요.
구성 파일을 작성한 후에는 배포를 만들기 전에 구성 미리보기를 수행할 수 있습니다. 구성 미리보기를 수행하면 리소스를 실제로 인스턴스화하지 않고도 Deployment Manager가 만들어야 하는 리소스를 확인할 수 있습니다. Deployment Manager 서비스는 다음 방법을 통해 구성 미리보기를 수행합니다.
템플릿을 포함하여 전체 구성을 확장합니다.
배포 및 '셸' 리소스를 만듭니다.
insert() 요청을 수행할 때 preview 쿼리 매개변수를 사용하면 구성을 미리 볼 수 있습니다.
개발자가 검토할 수 있도록 해당 상태가 IN_PREVIEW인 리소스 목록이 서버에서 반환됩니다.
The fingerprint of the deployment is ulPDrJON8E5ySHKC5fcukw==
Waiting for create [operation-1492785372594-54dae2ddbff50-58d45d53-12d483cf]...done.
Create operation operation-1492785372594-54dae2ddbff50-58d45d53-12d483cf completed successfully.
NAME TYPE STATE ERRORS INTENT
datadisk-example compute.v1.disk IN_PREVIEW [] CREATE_OR_ACQUIRE
vm-example compute.v1.instance IN_PREVIEW [] CREATE_OR_ACQUIRE
API
API에서 target 및 name 필드와 preview=true 쿼리 매개변수가 포함된 요청 본문과 함께 insert() 메서드를 사용합니다. target 필드에 구성을 제공합니다.
배포가 미리보기 모드일 때는 다른 구성을 진행할 수 없습니다. 예를 들어 vm.yaml이라는 구성을 사용하여 미리보기 모드에 있는 example-config라는 배포가 있다고 가정합니다. 미리보기 프로세스를 건너뛰고 two_vms.yaml이라는 새 구성을 동일한 배포에 배포하려 합니다. example-config는 아직 미리보기 모드에 있지만 새 구성을 배포할 수 없습니다. 미리보기를 취소한 후 새 설정으로 배포를 업데이트합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-03(UTC)"],[[["\u003cp\u003ePreviewing a configuration allows you to see the resources that Deployment Manager would create without actually instantiating them.\u003c/p\u003e\n"],["\u003cp\u003eYou can preview a configuration using the \u003ccode\u003epreview\u003c/code\u003e query parameter in an \u003ccode\u003einsert()\u003c/code\u003e request or with the \u003ccode\u003e--preview\u003c/code\u003e flag using the \u003ccode\u003egcloud\u003c/code\u003e command-line tool.\u003c/p\u003e\n"],["\u003cp\u003eAfter previewing a deployment, you can either commit the configuration by performing an update, cancel the preview and delete the deployment, or perform another preview with updated configuration files.\u003c/p\u003e\n"],["\u003cp\u003ePerforming multiple previews involves using the \u003ccode\u003eupdate\u003c/code\u003e command with the \u003ccode\u003e--preview\u003c/code\u003e flag or making a \u003ccode\u003ePUT()\u003c/code\u003e request with the \u003ccode\u003epreview=true\u003c/code\u003e query parameter to update an existing deployment.\u003c/p\u003e\n"],["\u003cp\u003eWhile a deployment is in preview mode, you cannot deploy a new configuration to the same deployment; you must cancel the preview before updating with a new configuration.\u003c/p\u003e\n"]]],[],null,["# Previewing a configuration\n\nThis page describes how to preview a configuration file before creating a\ndeployment. To learn more about configurations, read [Configurations Overview](/deployment-manager/docs/configuration).\n\nAfter you have [written a configuration file](/deployment-manager/docs/configuration/create-basic-configuration),\nyou can preview the configuration before you create a deployment. Previewing\na configuration lets you see the resources that Deployment Manager would create\nbut does not actually instantiate any actual resources. The\nDeployment Manager service previews the configuration by:\n\n1. Expanding the full configuration, including any templates.\n2. Creating a deployment and \"shell\" resources.\n\nYou can preview your configuration by using the `preview` query parameter when\nmaking an [`insert()`](/deployment-manager/docs/reference/latest/deployments/insert)\nrequest.\n\nBefore you begin\n----------------\n\n- If you want to use the command-line examples in this guide, install the [\\`gcloud\\` command-line tool](/sdk).\n- If you want to use the API examples in this guide, set up [API access](/deployment-manager/docs/reference/latest).\n- Understand how to [create a basic configuration](/deployment-manager/docs/configuration/create-basic-configuration).\n\nPreviewing a new configuration\n------------------------------\n\nPreview a configuration by using the Google Cloud CLI or by making a\ndirect request to the API. \n\n### gcloud\n\nIf you're using the Google Cloud CLI, use the `create` sub-command\nwith the `--preview` flag: \n\n gcloud deployment-manager deployments create example-config --config configuration-file.yaml \\\n --preview\n\nThe server returns a list of resources whose state is `IN_PREVIEW` for you\nto review: \n\n The fingerprint of the deployment is ulPDrJON8E5ySHKC5fcukw==\n Waiting for create [operation-1492785372594-54dae2ddbff50-58d45d53-12d483cf]...done.\n Create operation operation-1492785372594-54dae2ddbff50-58d45d53-12d483cf completed successfully.\n NAME TYPE STATE ERRORS INTENT\n datadisk-example compute.v1.disk IN_PREVIEW [] CREATE_OR_ACQUIRE\n vm-example compute.v1.instance IN_PREVIEW [] CREATE_OR_ACQUIRE\n\n### API\n\nIn the API, use the [`insert()`](/deployment-manager/docs/reference/latest/deployments/insert)\nmethod with a request body that contains the `target` and `name` fields and\nthe `preview=true` query parameter. Provide your configuration in the\n`target` field.\n\nFor example, the following API request previews a simple template: \n\n POST https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments?preview=true\n\n {\n \"name\": \"example-config\",\n \"target\": {\n \"config\": {\n \"content\": \"resources:\\n- name: vm-created-by-cloud-config\\n type: compute.v1.instance\\n properties:\\n zone: us-central1-a\\n machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1\\n disks:\\n - deviceName: boot\\n type: PERSISTENT\\n boot: true\\n autoDelete: true\\n initializeParams:\\n diskName: disk-created-by-cloud-config\\n sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619\\n networkInterfaces:\\n networkInterfaces:\\n - network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\"\n }\n }\n }\n\nWhen a deployment is in preview mode, you can move forward with the deployment in\none of three ways:\n\n- Deploy the configuration by [performing an update](/deployment-manager/docs/deployments/updating-deployments#make_the_update_request).\n- [Cancel the preview](#cancelpreview) and then delete the deployment.\n- [Update the preview](#performing_multiple_previews).\n\nPerforming multiple previews\n----------------------------\n\nIf you want to change your configuration and perform another preview,\nuse the `update` command with the `--preview` flag: \n\n gcloud deployment-manager deployments update example-config \\\n --config new-config.yaml --preview\n\nIn the API, make a\n[`PUT()`](/deployment-manager/docs/reference/latest/deployments/update)\nrequest with an existing deployment and provide the `preview=true` query\nparameter. The request body must contain the `intent`, `target`, and `name`\nfields. For example, the following API request previews a simple update: \n\n PUT https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments/example-config?preview=true\n\n {\n \"target\": {\n \"config\": {\n \"content\": \"resources:\\n- name: vm-created-by-cloud-config\\n type: compute.v1.instance\\n properties:\\n zone: us-central1-a\\n machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1\\n disks:\\n - deviceName: boot\\n type: PERSISTENT\\n boot: true\\n autoDelete: true\\n initializeParams:\\n diskName: disk-created-by-cloud-config\\n sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619\\n networkInterfaces:\\n - network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\"\n }\n },\n \"name\": \"example-config\"\n }\n\n| **Note:** In the API, you need to provide the deployment name in both the URL and in the request body.\n\nDeploying or canceling a preview\n--------------------------------\n\nAfter previewing a deployment, you can move forward with the deployment by\nperforming an update and committing the configuration. For example, assume you\nhave a deployment named example-config currently in preview mode. You can move\nforward with the deployment by running the following command: \n\n gcloud deployment-manager deployments update example-config\n\nDeployment Manager uses the last previewed configuration to create a\ndeployment.\n\nAlternatively, if you don't want to move forward with the configuration, you can\ncancel the preview, and then delete the deployment: \n\n gcloud deployment-manager deployments cancel-preview example-config\n\n| **Note:** If you perform many previews without canceling or moving forward with any of them, you will end up with many empty deployments. Make sure to [cancel](/deployment-manager/docs/deployments/updating-deployments#cancelpreview) and delete the deployments that you previewed but no longer need once you are done with them.\n\nWhile a deployment is in preview mode, you cannot move forward with another\nconfiguration. For example, assume you have a deployment called\n`example-config` that is in preview mode using a configuration named\n`vm.yaml`. You decide that you want to deploy a new configuration named\n`two_vms.yaml` to the same deployment, skipping the preview process. While\n`example-config` is still in preview mode, you cannot deploy a new\nconfiguration. Cancel the preview, and then\n[update the deployment](/deployment-manager/docs/deployments/updating-deployments)\nwith the new configuration.\n\nWhat's next\n-----------\n\n- Learn more about [configuration files](/deployment-manager/docs/configuration).\n- [Make an update](/deployment-manager/docs/deployments/updating-deployments) to your deployment after you deploy it."]]