无法创建Google Deployment Manager运行时配置变量的原因排查
Problem Statement
I'm attempting to create a Runtime Config variable via Google Deployment Manager using this YAML configuration:
resources: - name: star-config type: runtimeconfig.v1beta1.config properties: name: star-config - name: igurl_variable type: runtimeconfig.v1beta1.variable properties: name: igurl_variable value: 'trek' parent: $(ref.star-config.name)
When I run the deployment, the logs show a bad_request status, and audit logs return { message: "BAD_REQUEST" }. What’s causing this?
Root Causes & Fixes
Let's break down the most likely issues and how to fix them:
Incorrect field used for the variable's relative name
This is the primary culprit. When you specify aparent(yourstar-configresource) for the variable, you shouldn't use thenamefield in the variable's properties. Thenamefield expects a full, absolute resource path (likeprojects/your-project-id/configs/star-config/variables/igurl_variable), whileparenttells the API to use a relative path. To define the variable's short name alongsideparent, you need to userelativeNameinstead.Here's the corrected variable block:
- name: igurl_variable type: runtimeconfig.v1beta1.variable properties: relativeName: igurl_variable value: 'trek' parent: $(ref.star-config.name)Redundant
nameproperty in the Config resource
While this isn't causing the BAD_REQUEST, thenamefield inside yourstar-configproperties is unnecessary. Deployment Manager automatically uses the top-levelname(underresources) to generate the Config resource's identifier. You can safely remove that line to clean up your config:- name: star-config type: runtimeconfig.v1beta1.config # Removed redundant properties.name entryRuntime Config API not enabled
If you haven't enabled the Runtime Config API for your Google Cloud project, Deployment Manager can't create these resources, which will trigger a BAD_REQUEST error. Head to your Cloud Console's API Library to verify the API is enabled.
内容的提问来源于stack exchange,提问作者Varunkumar Manohar

