1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【作業メモ】TerraformコードとしてエクスポートできるGCPリソースを整理する

Posted at

とりあえずbulk-exportでプロジェクト配下のリソースをエクスポートしたけど、
bulk-exportコマンドでエクスポートできる・できないリソースを整理。

エクスポートしたときの作業メモ

コマンドでエクスポートできるリソース一覧を出力して、bulk-exportできる/できないで分類。
実行日は2023/7/27。

エクスポートできるリソース

ArtifactRegistryRepository
BigQueryDataset
BigQueryTable
BigtableAppProfile
BigtableInstance
BigtableTable
ComputeAddress
ComputeAddress
ComputeBackendBucket
ComputeBackendService
ComputeBackendService
ComputeDisk
ComputeDisk
ComputeExternalVPNGateway
ComputeFirewall
ComputeForwardingRule
ComputeForwardingRule
ComputeHTTPHealthCheck
ComputeHTTPSHealthCheck
ComputeHealthCheck
ComputeHealthCheck
ComputeImage
ComputeInstance
ComputeInstanceGroup
ComputeInstanceTemplate
ComputeInterconnectAttachment
ComputeNetwork
ComputeNetworkEndpointGroup
ComputeNodeGroup
ComputeNodeTemplate
ComputeReservation
ComputeResourcePolicy
ComputeRoute
ComputeRouter
ComputeSSLCertificate
ComputeSSLPolicy
ComputeSecurityPolicy
ComputeSnapshot
ComputeSubnetwork
ComputeTargetHTTPProxy
ComputeTargetHTTPSProxy
ComputeTargetInstance
ComputeTargetPool
ComputeTargetTCPProxy
ComputeTargetVPNGateway
ComputeURLMap
ComputeVPNGateway
ComputeVPNTunnel
ContainerCluster
ContainerNodePool
DNSManagedZone
DNSPolicy
IAMCustomRole
IAMServiceAccount
KMSCryptoKey
KMSKeyRing
LoggingLogSink
MemcacheInstance
MonitoringAlertPolicy
PubSubSubscription
PubSubTopic
RedisInstance
Folder
Project
SecretManagerSecret
SecretManagerSecretVersion
ServiceDirectoryNamespace
Service
SourceRepoRepository
SpannerDatabase
SpannerInstance
SQLInstance
StorageBucket

エクスポートできないリソース

AccessContextManagerAccessLevel
AccessContextManagerAccessPolicy
AccessContextManagerServicePerimeter
BigQueryJob 
BigtableGCPolicy
CloudBuildTrigger
CloudIdentityGroup
ComputeNetworkPeering
ComputeProjectMetadata
ComputeRegionNetworkEndpointGroup
ComputeRouterInterface
ComputeRouterNAT
ComputeRouterPeer
ComputeSharedVPCHostProject
ComputeSharedVPCServiceProject
ComputeTargetGRPCProxy
DataflowFlexTemplateJob
DataflowJob
DNSRecordSet
FirestoreIndex
MonitoringNotificationChannel
ComputeTargetSSLProxy
PubSubSchema
ResourceManagerLien
ResourceManagerPolicy
IAMServiceAccountKey
ServiceDirectoryEndpoint
ServiceDirectoryService
ServiceNetworkingConnection
SQLDatabase
SQLSSLCert
SQLUser
StorageBucketAccessControl
StorageDefaultObjectAccessControl
StorageNotification
StorageTransferJob

2. サポートされていないリソースタイプを指定してエクスポートしようとしてみる

INVALIDって言われるけど、サポートしているリソース一覧のURLもくれた

エラーメッセージ

INVALID_ARGUMENT: No CONTENT_TYPE_UNSPECIFIED found that matches asset type storagetransfer.googleapis.com/Job for consumer project: xxxxxxxxxx. For a list of supported content types and asset types, see https://cloud.google.com/asset-inventory/docs/supported-asset-types
- '@type': type.googleapis.com/google.rpc.BadRequest

3. エクスポート可能なリソース一覧を表示する方法

エクスポートできるリソースを表示

gcloud beta resource-config list-resource-types

リダイレクトして.txtに出力したのでローカルに持ってくる

cloudshellで以下コマンドを実行するとファイルをローカルにダウンロードできる
(受け渡しできるのはホームディレクトリのフォルダ・ファイルのみ)

cloudshell download ファイル名

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?