Config Connector により、resourceID フィールド(変更不可、ただし省略可能)を使用して Google Cloudリソースのリソース ID を明示的に指定し、リソースを作成または取得できます。「変更不可、ただし省略可能」は、resourceID フィールドの指定を行うか行わないかを選択できるものの、マニフェストをクラスタに追加した後で resourceID フィールドの値を変更できないことを示します。
resourceID フィールドを使用すると、ユーザー指定のリソース ID が設定された Google Cloudリソースの名前をより柔軟に指定できます。Config Connector リソースの resourceID フィールドを使用すると、同じ名前空間内の複数のプロジェクト、フォルダ、組織、または親のもとで、同じ Google Cloudリソース名が設定された同じ種類の複数の Config Connector リソースを定義できます。また、 Google Cloud リソース名は、Kubernetes オブジェクト名の命名規則によって制限されません。さらに、resourceID フィールドにより、サービス生成のリソース ID が設定された Google Cloud リソースを取得できます。
Config Connector は名前空間をリソースの「オーナー」にし、別のオーナーがリソースを利用しないようにします。ただし、resourceID フィールドを使用している場合は、同じ Google Cloud リソース名が設定された複数のリソースが、同じ名前空間の下に作成される可能性があります。これらのリソースにより、Config Connector で管理できない競合が発生します。競合を手動で解決する必要があります。
リソース ID の種類
Config Connector では、リソース ID のユーザーによる指定またはサービスによる生成が可能です。
ユーザー指定のリソース ID
リソースの作成前に、ユーザーによって決定、指定され、渡されるリソース ID。resourceID フィールドで、ユーザー指定のリソース ID を持つリソースを作成または取得できます。
サービス生成のリソース ID
リソースの作成時にサービスによって生成されたリソース ID。リソースが正常に作成された後、ユーザーが取得できます。resourceID フィールドを使用して、サービス生成のリソース ID を持つリソースを取得できます。サービス生成のリソース ID を持つ新しいリソースを作成する場合は、このフィールドを指定しないでください。 サービス生成のリソース ID を持つリソースの一覧をご覧ください。
apiVersion:resourcemanager.cnrm.cloud.google.com/v1beta1kind:Foldermetadata:annotations:cnrm.cloud.google.com/organization-id:ORG_ID# Remove the deletion-policy annotation if it is safe to delete the# folder when the resource is deleted from your cluster.cnrm.cloud.google.com/deletion-policy:"abandon"name:folder-sample-for-acquisitionspec:resourceID:ACQUIRED_FOLDER_IDdisplayName:ACQUIRED_FOLDER_DISPLAY_NAME
[[["わかりやすい","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-04 UTC。"],[[["\u003cp\u003eThe \u003ccode\u003eresourceID\u003c/code\u003e field in Config Connector allows you to explicitly specify the resource ID of a Google Cloud resource, offering flexibility in naming.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eresourceID\u003c/code\u003e, you can manage multiple Config Connector resources with the same Google Cloud resource name across different projects, folders, or organizations within a namespace.\u003c/p\u003e\n"],["\u003cp\u003eResource IDs can be user-specified, defined by the user, or service-generated, determined by the service during resource creation.\u003c/p\u003e\n"],["\u003cp\u003eSpecifying \u003ccode\u003eresourceID\u003c/code\u003e enables both the creation of new resources and the acquisition of existing ones, with the system attempting acquisition if the resource has a service-generated ID.\u003c/p\u003e\n"],["\u003cp\u003eWhile \u003ccode\u003eresourceID\u003c/code\u003e provides flexibility, it can also lead to conflicts with multiple resources sharing the same name in a namespace, requiring manual conflict resolution.\u003c/p\u003e\n"]]],[],null,["# Managing resources with the resourceID field\n============================================\n\n*** ** * ** ***\n\nThis page explains how to manage resources with the `resourceID` field.\n\nConfig Connector lets you explicitly specify the [resource\nID](/apis/design/resource_names#resource_id) of a Google Cloud\nresource using the immutable but optional *`resourceID` field* to create or\nacquire the resource. \"Immutable, but optional\" means that you can choose to\nspecify or not specify the `resourceID` field, but you can't make any changes to\nthe value of the `resourceID` field after applying the manifest to your cluster.\n\nThe `resourceID` field increases the flexibility of naming a Google Cloud\nresource that has a\n[user-specified resource ID](#types_of_resource_ids). Using the `resourceID`\nfield in your Config Connector resources, you can define multiple\nConfig Connector resources of the same kind with the same Google Cloud\nresource name under different projects, folders, organizations or parent\nresources within the same namespace. The Google Cloud resource name is\nalso not restricted by the\n[naming convention](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names)\nof a Kubernetes object name. In addition, the `resourceID` field enables the\nacquisition of a Google Cloud resource that has a [service-generated\nresource ID](#types_of_resource_ids).\n\nConfig Connector makes the namespace the \"owner\" of a resource to prevent it\nfrom being taken by another owner. However, if you are using the `resourceID` field,\nthere can be multiple resources with the same Google Cloud resource name,\ncreated under the same namespace. These resources create conflicts that Config Connector\ncannot [manage](/config-connector/docs/concepts/managing-conflicts). You need to\nresolve any conflicts manually.\n\nTypes of resource IDs\n---------------------\n\nIn Config Connector, resource IDs can be *user-specified* or\n*service-generated*.\n\nUser-specified resource IDs\n: A resource ID that is determined, specified, and passed in by the user before\n the resource creation. You can create or acquire a resource that has a\n user-specified resource ID with the `resourceID` field.\n\nService-generated resource IDs\n: A resource ID that is generated by the service during the resource creation.\n It can be retrieved by the user after the resource is successfully created. You\n can acquire a resource that has a service-generated resource ID with the\n `resourceID` field. Leave the field unspecified if you want to create a new\n resource that has a service-generated resource ID. See the list of [Resources with a service-generated resource\n ID](/config-connector/docs/how-to/managing-deleting-resources#service-generated-resource-id).\n\nSpecifying the resourceID field\n-------------------------------\n\nYou can specify the `resourceID` field in the resource's `spec`.\n\nThe following manifest describes how to specify the `resourceID` field for a\nPub/Sub topic. The name of the Config Connector resource is\n`pubsub-topic-sample` and the name of the Pub/Sub topic is\n`pubsub-topic-id`. \n\n apiVersion: pubsub.cnrm.cloud.google.com/v1beta1\n kind: PubSubTopic\n metadata:\n name: pubsub-topic-sample\n spec:\n resourceID: pubsub-topic-id\n\nCreating a resource with the resourceID field\n---------------------------------------------\n\n| **Note:** When you manage a Google Cloud resource with the `resourceID` field, if the resource has a service-generated resource ID, Config Connector assumes the resource already exists and tries to acquire the resource.\n\n### Creating a BigQuery dataset\n\nIn this example, you create a new BigQuery dataset using\nConfig Connector with the `resourceID` field. The value of the `resourceID`\nfield should follow the\n[naming convention for the `datasetId` field](https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#datasetreference)\nof the BigQuery dataset.\n\n1. Copy the following contents into a file named `bigquery-dataset.yaml`.\n\n apiVersion: bigquery.cnrm.cloud.google.com/v1beta1\n kind: BigQueryDataset\n metadata:\n name: bigquerydataset-sample-for-creation\n spec:\n resourceID: bigquerydataset_sample_with_resourceid\n defaultTableExpirationMs: 3600000\n description: \"BigQuery Dataset Sample with the ResourceID Field\"\n friendlyName: bigquerydataset-sample-with-resourceid\n location: US\n\n2. Apply the YAML file to your cluster.\n\n ```\n kubectl apply --namespace CC_NAMESPACE -f bigquery-dataset.yaml\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n3. Use `kubectl describe` to see details on the dataset.\n\n ```\n kubectl describe --namespace CC_NAMESPACE bigquerydataset bigquerydataset-sample-for-creation\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n\nAcquiring a resource with the resourceID field\n----------------------------------------------\n\nWhen you manage a Google Cloud resource with the `resourceID` field,\nConfig Connector acquires the resource if:\n\n- The resource has a user-specified resource ID, and the values in the manifest and the resource name match an existing resource; Or,\n- The resource has a service-generated resource ID.\n\n### Acquiring a folder\n\nTo acquire a folder using Config Connector with the `resourceID` field, complete\nthe following steps:\n\n1. Copy the following contents into a file named `folder.yaml`.\n\n apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1\n kind: Folder\n metadata:\n annotations:\n cnrm.cloud.google.com/organization-id: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eORG_ID\u003c/span\u003e\u003c/var\u003e\n # Remove the deletion-policy annotation if it is safe to delete the\n # folder when the resource is deleted from your cluster.\n cnrm.cloud.google.com/deletion-policy: \"abandon\"\n name: folder-sample-for-acquisition\n spec:\n resourceID: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eACQUIRED_FOLDER_ID\u003c/span\u003e\u003c/var\u003e\n displayName: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eACQUIRED_FOLDER_DISPLAY_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eORG_ID\u003c/var\u003e with the numeric ID for your organization.\n - \u003cvar translate=\"no\"\u003eACQUIRED_FOLDER_ID\u003c/var\u003e with the numeric ID for the folder to be acquired.\n - \u003cvar translate=\"no\"\u003eACQUIRED_FOLDER_DISPLAY_NAME\u003c/var\u003e with the display name for the folder to be acquired.\n2. Apply the YAML file to your cluster.\n\n ```\n kubectl apply --namespace CC_NAMESPACE -f folder.yaml\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n3. Use `kubectl describe` to see details on the folder.\n\n ```\n kubectl describe --namespace CC_NAMESPACE folder folder-sample-for-acquisition\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n\nWhat's next\n-----------\n\nReview the [Resource reference](/config-connector/docs/reference/resources) to\nlearn about the resources Config Connector supports."]]