Google Cloud 組織のポリシーを使用すると、組織のリソースをプログラマティックに一元管理できます。組織のポリシー管理者は組織のポリシーを定義できます。組織のポリシーは、Google Cloud リソース階層内のGoogle Cloud リソースやそれらのリソースの子孫に適用される、制約と呼ばれる一連の制限です。組織のポリシーは、組織レベル、フォルダレベル、またはプロジェクト レベルで適用できます。
組織のポリシーは、さまざまなGoogle Cloud サービスに事前に定義された制約を提供します。ただし、組織のポリシーで制限されている特定のフィールドをきめ細かく制御する必要がある場合は、カスタム制約を作成して、カスタム組織ポリシーでそれらのカスタム制約を使用することもできます。
次のロード バランシング コンポーネントは、カスタム制約をサポートしています。
- バックエンド バケット
- バックエンド サービス
- 転送ルール
- ヘルスチェック
- ネットワーク エンドポイント グループ
- サービス ロード バランシング ポリシー
- SSL ポリシー
- ターゲット インスタンス
- ターゲット プール
- ターゲット プロキシ
- URL マップ
カスタム制約は、インスタンス グループなどの Compute Engine リソースや、VPC ネットワークとサブネットのような VPC リソースでもサポートされています。
利点
- 費用管理: カスタムの組織のポリシーを使用して、ヘルスチェック プローブの頻度を制限します。
セキュリティ、コンプライアンス、ガバナンス: カスタムの組織のポリシーを使用して、ポリシーを適用できます。例:
- 特定のヘルスチェック プロトコルまたはポート範囲の使用を強制する
- 特定のバックエンド トラフィック プロトコルを禁止する
- バックエンド バケットで Cloud CDN を有効にすることを必須にする
- 転送ルールで特定の Network Service Tiers の使用を必須にするには
Cloud Load Balancing でサポートされているリソース
Cloud Load Balancing では、次のリソースとフィールドにカスタム制約を設定できます。
バックエンド バケット
バックエンド バケット: compute.googleapis.com/BackendBucket
resource.nameresource.descriptionresource.bucketNameresource.enableCdnresource.cdnPolicyresource.cdnPolicy.bypassCacheOnRequestHeadersresource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
resource.cdnPolicy.cacheKeyPolicyresource.cdnPolicy.cacheKeyPolicy.includeHttpHeadersresource.cdnPolicy.cacheKeyPolicy.queryStringWhitelistresource.cdnPolicy.signedUrlCacheMaxAgeSec
resource.compressionModeresource.customResponseHeaders
バックエンド サービス
バックエンド サービス: compute.googleapis.com/BackendService
resource.nameresource.descriptionresource.portresource.portNameresource.protocolresource.backendsresource.backends.balancingModeresource.backends.capacityScalerresource.backends.descriptionresource.backends.failoverresource.backends.maxConnectionsresource.backends.maxConnectionsPerEndpointresource.backends.maxConnectionsPerInstanceresource.backends.maxRateresource.backends.maxRatePerEndpointresource.backends.maxRatePerInstanceresource.backends.maxUtilizationresource.backends.preference
resource.enableCDNresource.cdnPolicyresource.cdnPolicy.bypassCacheOnRequestHeadersresource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
resource.cdnPolicy.cacheKeyPolicyresource.cdnPolicy.cacheKeyPolicy.includeHostresource.cdnPolicy.cacheKeyPolicy.includeHttpHeadersresource.cdnPolicy.cacheKeyPolicy.includeNamedCookiesresource.cdnPolicy.cacheKeyPolicy.includeProtocolresource.cdnPolicy.cacheKeyPolicy.includeQueryStringresource.cdnPolicy.cacheKeyPolicy.queryStringBlacklistresource.cdnPolicy.cacheKeyPolicy.queryStringWhitelist
resource.cdnPolicy.cacheModeresource.cdnPolicy.clientTtlresource.cdnPolicy.defaultTtlresource.cdnPolicy.maxTtlresource.cdnPolicy.negativeCachingresource.cdnPolicy.negativeCachingPolicyresource.cdnPolicy.negativeCachingPolicy.coderesource.cdnPolicy.negativeCachingPolicy.ttl
resource.cdnPolicy.requestCoalescingresource.cdnPolicy.serveWhileStaleresource.cdnPolicy.signedUrlCacheMaxAgeSec
resource.circuitBreakersresource.circuitBreakers.maxConnectionsresource.circuitBreakers.maxPendingRequestsresource.circuitBreakers.maxRequestsresource.circuitBreakers.maxRequestsPerConnectionresource.circuitBreakers.maxRetries
resource.compressionModeresource.connectionDrainingresource.connectionDraining.drainingTimeoutSec
resource.connectionTrackingPolicyresource.connectionTrackingPolicy.connectionPersistenceOnUnhealthyBackendsresource.connectionTrackingPolicy.enableStrongAffinityresource.connectionTrackingPolicy.idleTimeoutSecresource.connectionTrackingPolicy.trackingMode
resource.consistentHashresource.consistentHash.httpCookieresource.consistentHash.httpCookie.nameresource.consistentHash.httpCookie.pathresource.consistentHash.httpCookie.ttlresource.consistentHash.httpCookie.ttl.nanosresource.consistentHash.httpCookie.ttl.seconds
resource.consistentHash.minimumRingSize
resource.customRequestHeadersresource.customResponseHeadersresource.affinityCookieTtlSecresource.failoverPolicyresource.failoverPolicy.disableConnectionDrainOnFailoverresource.failoverPolicy.dropTrafficIfUnhealthyresource.failoverPolicy.failoverRatio
resource.iapresource.iap.enabledresource.iap.oauth2ClientId
resource.ipAddressSelectionPolicyresource.loadBalancingSchemeresource.localityLbPoliciesresource.localityLbPolicies.customPolicyresource.localityLbPolicies.customPolicy.dataresource.localityLbPolicies.customPolicy.nameresource.localityLbPolicies.policyresource.localityLbPolicies.policy.name
resource.logConfigresource.logConfig.enableresource.logConfig.optionalFieldsresource.logConfig.optionalModeresource.logConfig.sampleRate
resource.maxStreamDurationresource.maxStreamDuration.nanosresource.maxStreamDuration.seconds
resource.outlierDetectionresource.outlierDetection.baseEjectionTimeresource.outlierDetection.baseEjectionTime.nanosresource.outlierDetection.baseEjectionTime.secondsresource.outlierDetection.consecutiveGatewayFailureresource.outlierDetection.enforcingConsecutiveErrorsresource.outlierDetection.enforcingConsecutiveGatewayFailureresource.outlierDetection.enforcingSuccessRateresource.outlierDetection.maxEjectionPercentresource.outlierDetection.successRateMinimumHostsresource.outlierDetection.successRateRequestVolumeresource.outlierDetection.successRateStdevFactor
resource.securitySettingsresource.securitySettings.awsV4Authenticationresource.securitySettings.awsV4Authentication.accessKeyIdresource.securitySettings.awsV4Authentication.accessKeyVersionresource.securitySettings.subjectAltNames
resource.sessionAffinityresource.subsettingresource.subsetting.policy
resource.timeoutSecresource.strongSessionAffinityCookieresource.strongSessionAffinityCookie.nameresource.strongSessionAffinityCookie.pathresource.strongSessionAffinityCookie.ttlresource.strongSessionAffinityCookie.ttl.nanosresource.strongSessionAffinityCookie.ttl.seconds
転送ルール
転送ルール: compute.googleapis.com/ForwardingRule
resource.nameresource.descriptionresource.allowGlobalAccessresource.allowPscGlobalAccessresource.allPortsresource.IPProtocolresource.ipVersionresource.isMirroringCollectorresource.loadBalancingSchemeresource.metadataFiltersresource.metadataFilters.filterLabelsresource.metadataFilters.filterLabels.nameresource.metadataFilters.filterLabels.valueresource.metadataFilters.filterMatchCriteria
resource.networkTierresource.noAutomateDnsZoneresource.portRangeresource.portsresource.serviceDirectoryRegistrationsresource.serviceDirectoryRegistrations.namespaceresource.serviceDirectoryRegistrations.serviceresource.serviceDirectoryRegistrations.serviceDirectoryRegion
resource.serviceLabelresource.sourceIpRanges
ヘルスチェック
ヘルスチェック: compute.googleapis.com/HealthCheck
resource.nameresource.descriptionresource.checkIntervalSecresource.timeoutSecresource.unhealthyThresholdresource.healthyThresholdresource.type- TCP ヘルスチェック:
resource.tcpHealthCheck.portresource.tcpHealthCheck.requestresource.tcpHealthCheck.responseresource.tcpHealthCheck.proxyHeaderresource.tcpHealthCheck.portSpecification
- SSL ヘルスチェック:
resource.sslHealthCheck.portresource.sslHealthCheck.requestresource.sslHealthCheck.responseresource.sslHealthCheck.proxyHeaderresource.sslHealthCheck.portSpecification
- HTTP ヘルスチェック:
resource.httpHealthCheck.portresource.httpHealthCheck.hostresource.httpHealthCheck.requestPathresource.httpHealthCheck.proxyHeaderresource.httpHealthCheck.responseresource.httpHealthCheck.portSpecification
- HTTPS ヘルスチェック:
resource.httpsHealthCheck.portresource.httpsHealthCheck.hostresource.httpsHealthCheck.requestPathresource.httpsHealthCheck.proxyHeaderresource.httpsHealthCheck.responseresource.httpsHealthCheck.portSpecification
- HTTP/2 ヘルスチェック:
resource.http2HealthCheck.portresource.http2HealthCheck.hostresource.http2HealthCheck.requestPathresource.http2HealthCheck.proxyHeaderresource.http2HealthCheck.responseresource.http2HealthCheck.portSpecification
- gRPC ヘルスチェック:
resource.grpcHealthCheck.portresource.grpcHealthCheck.grpcServiceNameresource.grpcHealthCheck.portSpecification
resource.sourceRegionsresource.logConfigresource.logConfig.enable
ネットワーク エンドポイント グループ
ネットワーク エンドポイント グループ: compute.googleapis.com/NetworkEndpointGroup
resource.annotationsresource.appEngine.serviceresource.appEngine.urlMaskresource.appEngine.versionresource.cloudFunction.functionresource.cloudFunction.urlMaskresource.cloudRun.serviceresource.cloudRun.tagresource.cloudRun.urlMaskresource.defaultPortresource.descriptionresource.nameresource.networkresource.networkEndpointTyperesource.pscData.producerPortresource.pscTargetServiceresource.subnetwork
サービス ロード バランシング ポリシー
サービス ロード バランシング ポリシー: networkservices.googleapis.com/ServiceLbPolicy
resource.autoCapacityDrain.enableresource.descriptionresource.failoverConfig.failoverHealthThresholdresource.loadBalancingAlgorithmresource.name
SSL ポリシー
SSL ポリシー: compute.googleapis.com/SslPolicy
resource.profileresource.nameresource.descriptionresource.minTlsVersionresource.customFeatures
ターゲット インスタンス
ターゲット インスタンス: compute.googleapis.com/TargetInstance
resource.nameresource.descriptionresource.natPolicy
ターゲット プール
ターゲット プール: compute.googleapis.com/TargetPool
resource.nameresource.descriptionresource.sessionAffinityresource.failoverRatio
ターゲット プロキシ
ターゲット TCP プロキシ: compute.googleapis.com/TargetTcpProxy
resource.nameresource.descriptionresource.proxyBindresource.proxyHeader
ターゲット SSL プロキシ: compute.googleapis.com/TargetSslProxy
resource.nameresource.descriptionresource.proxyHeader
ターゲット HTTP プロキシ: compute.googleapis.com/TargetHttpProxy
resource.nameresource.descriptionresource.proxyBindresource.httpKeepAliveTimeoutSec
ターゲット HTTPS プロキシ: compute.googleapis.com/TargetHttpsProxy
resource.nameresource.descriptionresource.proxyBindresource.httpKeepAliveTimeoutSecresource.quicOverrideresource.tlsEarlyData
ターゲット gRPC プロキシ: compute.googleapis.com/TargetGrpcProxy
resource.nameresource.descriptionresource.validateForProxyless
URL マップ
URL マップ: compute.googleapis.com/UrlMap
resource.nameresource.descriptionresource.defaultCustomErrorResponsePolicyresource.defaultCustomErrorResponsePolicy.errorResponseRulesresource.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.defaultCustomErrorResponsePolicy.errorResponseRules.path
resource.defaultRouteActionresource.defaultRouteAction.corsPolicyresource.defaultRouteAction.corsPolicy.allowCredentialsresource.defaultRouteAction.corsPolicy.allowHeadersresource.defaultRouteAction.corsPolicy.allowMethodsresource.defaultRouteAction.corsPolicy.allowOriginsresource.defaultRouteAction.corsPolicy.allowOriginRegexesresource.defaultRouteAction.corsPolicy.disabledresource.defaultRouteAction.corsPolicy.exposeHeadersresource.defaultRouteAction.corsPolicy.maxAgeresource.defaultRouteAction.faultInjectionPolicyresource.defaultRouteAction.faultInjectionPolicy.abortresource.defaultRouteAction.faultInjectionPolicy.abort.httpStatusresource.defaultRouteAction.faultInjectionPolicy.abort.percentage
resource.defaultRouteAction.faultInjectionPolicy.delayresource.defaultRouteAction.faultInjectionPolicy.delay.percentageresource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelayresource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.defaultRouteAction.maxStreamDurationresource.defaultRouteAction.maxStreamDuration.nanosresource.defaultRouteAction.maxStreamDuration.secondsresource.defaultRouteAction.requestMirrorPolicyresource.defaultRouteAction.retryPolicyresource.defaultRouteAction.retryPolicy.numRetriesresource.defaultRouteAction.retryPolicy.perTryTimeoutresource.defaultRouteAction.retryPolicy.perTryTimeout.nanosresource.defaultRouteAction.retryPolicy.perTryTimeout.seconds
resource.defaultRouteAction.retryPolicy.retryConditionsresource.defaultRouteAction.timeoutresource.defaultRouteAction.timeout.nanosresource.defaultRouteAction.timeout.secondsresource.defaultRouteAction.urlRewriteresource.defaultRouteAction.urlRewrite.hostRewriteresource.defaultRouteAction.urlRewrite.pathPrefixRewriteresource.defaultRouteAction.urlRewrite.pathTemplateRewriteresource.defaultRouteAction.weightedBackendServicesresource.defaultRouteAction.weightedBackendServices.headerActionresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAddresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replaceresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAddresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replaceresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.defaultRouteAction.weightedBackendServices.weight
resource.defaultUrlRedirectresource.defaultUrlRedirect.hostRedirectresource.defaultUrlRedirect.httpsRedirectresource.defaultUrlRedirect.pathRedirectresource.defaultUrlRedirect.prefixRedirectresource.defaultUrlRedirect.redirectResponseCoderesource.defaultUrlRedirect.stripQuery
resource.headerActionresource.headerAction.requestHeadersToAddresource.headerAction.requestHeadersToAdd.headerNameresource.headerAction.requestHeadersToAdd.headerValueresource.headerAction.requestHeadersToAdd.replaceresource.headerAction.requestHeadersToRemoveresource.headerAction.responseHeadersToAddresource.headerAction.responseHeadersToAdd.headerNameresource.headerAction.responseHeadersToAdd.headerValueresource.headerAction.responseHeadersToAdd.replaceresource.headerAction.responseHeadersToRemove
resource.hostRulesresource.hostRules.descriptionresource.hostRules.hostsresource.hostRules.pathMatcher
resource.pathMatchersresource.pathMatchers.nameresource.pathMatchers.descriptionresource.pathMatchers.defaultCustomErrorResponsePolicyresource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRulesresource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.defaultRouteActionresource.pathMatchers.defaultRouteAction.corsPolicyresource.pathMatchers.defaultRouteAction.corsPolicy.allowCredentialsresource.pathMatchers.defaultRouteAction.corsPolicy.allowHeadersresource.pathMatchers.defaultRouteAction.corsPolicy.allowMethodsresource.pathMatchers.defaultRouteAction.corsPolicy.allowOriginsresource.pathMatchers.defaultRouteAction.corsPolicy.allowOriginRegexesresource.pathMatchers.defaultRouteAction.corsPolicy.disabledresource.pathMatchers.defaultRouteAction.corsPolicy.exposeHeadersresource.pathMatchers.defaultRouteAction.corsPolicy.maxAge
resource.pathMatchers.defaultRouteAction.faultInjectionPolicyresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abortresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.httpStatusresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.percentageresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delayresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.percentageresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelayresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.defaultRouteAction.maxStreamDurationresource.pathMatchers.defaultRouteAction.maxStreamDuration.nanosresource.pathMatchers.defaultRouteAction.maxStreamDuration.seconds
resource.pathMatchers.defaultRouteAction.requestMirrorPolicyresource.pathMatchers.defaultRouteAction.retryPolicyresource.pathMatchers.defaultRouteAction.retryPolicy.numRetriesresource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeoutresource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.nanosresource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.secondsresource.pathMatchers.defaultRouteAction.retryPolicy.retryConditions
resource.pathMatchers.defaultRouteAction.timeoutresource.pathMatchers.defaultRouteAction.timeout.nanosresource.pathMatchers.defaultRouteAction.timeout.seconds
resource.pathMatchers.defaultRouteAction.urlRewriteresource.pathMatchers.defaultRouteAction.urlRewrite.hostRewriteresource.pathMatchers.defaultRouteAction.urlRewrite.pathPrefixRewriteresource.pathMatchers.defaultRouteAction.urlRewrite.pathTemplateRewrite
resource.pathMatchers.defaultRouteAction.weightedBackendServicesresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerActionresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAddresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAddresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemoveresource.pathMatchers.defaultRouteAction.weightedBackendServices.weight
resource.pathMatchers.defaultUrlRedirectresource.pathMatchers.defaultUrlRedirect.hostRedirectresource.pathMatchers.defaultUrlRedirect.httpsRedirectresource.pathMatchers.defaultUrlRedirect.pathRedirectresource.pathMatchers.defaultUrlRedirect.prefixRedirectresource.pathMatchers.defaultUrlRedirect.redirectResponseCoderesource.pathMatchers.defaultUrlRedirect.stripQueryresource.pathMatchers.headerActionresource.pathMatchers.headerAction.requestHeadersToAddresource.pathMatchers.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.headerAction.requestHeadersToRemoveresource.pathMatchers.headerAction.responseHeadersToAddresource.pathMatchers.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.headerAction.responseHeadersToRemoveresource.pathMatchers.pathRulesresource.pathMatchers.pathRules.pathsresource.pathMatchers.pathRules.customErrorResponsePolicyresource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRulesresource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.pathRules.routeActionresource.pathMatchers.pathRules.routeAction.corsPolicyresource.pathMatchers.pathRules.routeAction.corsPolicy.allowCredentialsresource.pathMatchers.pathRules.routeAction.corsPolicy.allowHeadersresource.pathMatchers.pathRules.routeAction.corsPolicy.allowMethodsresource.pathMatchers.pathRules.routeAction.corsPolicy.allowOriginsresource.pathMatchers.pathRules.routeAction.corsPolicy.allowOriginRegexesresource.pathMatchers.pathRules.routeAction.corsPolicy.disabledresource.pathMatchers.pathRules.routeAction.corsPolicy.exposeHeadersresource.pathMatchers.pathRules.routeAction.corsPolicy.maxAgeresource.pathMatchers.pathRules.routeAction.faultInjectionPolicyresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abortresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.httpStatusresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delayresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.percentageresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelayresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.pathRules.routeAction.maxStreamDurationresource.pathMatchers.pathRules.routeAction.maxStreamDuration.nanosresource.pathMatchers.pathRules.routeAction.maxStreamDuration.secondsresource.pathMatchers.pathRules.routeAction.requestMirrorPolicyresource.pathMatchers.pathRules.routeAction.retryPolicyresource.pathMatchers.pathRules.routeAction.retryPolicy.numRetriesresource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeoutresource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.nanosresource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.pathRules.routeAction.retryPolicy.retryConditionsresource.pathMatchers.pathRules.routeAction.timeoutresource.pathMatchers.pathRules.routeAction.timeout.nanosresource.pathMatchers.pathRules.routeAction.timeout.secondsresource.pathMatchers.pathRules.routeAction.urlRewriteresource.pathMatchers.pathRules.routeAction.urlRewrite.hostRewriteresource.pathMatchers.pathRules.routeAction.urlRewrite.pathPrefixRewriteresource.pathMatchers.pathRules.routeAction.urlRewrite.pathTemplateRewriteresource.pathMatchers.pathRules.routeAction.weightedBackendServicesresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerActionresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAddresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAddresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.weight
resource.pathMatchers.pathRules.urlRedirectresource.pathMatchers.pathRules.urlRedirect.hostRedirectresource.pathMatchers.pathRules.urlRedirect.httpsRedirectresource.pathMatchers.pathRules.urlRedirect.pathRedirectresource.pathMatchers.pathRules.urlRedirect.prefixRedirectresource.pathMatchers.pathRules.urlRedirect.redirectResponseCoderesource.pathMatchers.pathRules.urlRedirect.stripQuery
resource.pathMatchers.routeRulesresource.pathMatchers.routeRules.descriptionresource.pathMatchers.routeRules.priorityresource.pathMatchers.routeRules.customErrorResponsePolicyresource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRulesresource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.routeRules.headerActionresource.pathMatchers.routeRules.headerAction.requestHeadersToAddresource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.routeRules.headerAction.requestHeadersToRemoveresource.pathMatchers.routeRules.headerAction.responseHeadersToAddresource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.routeRules.headerAction.responseHeadersToRemove
resource.pathMatchers.routeRules.matchRulesresource.pathMatchers.routeRules.matchRules.fullPathMatchresource.pathMatchers.routeRules.matchRules.headerMatchesresource.pathMatchers.routeRules.matchRules.headerMatches.exactMatchresource.pathMatchers.routeRules.matchRules.headerMatches.headerNameresource.pathMatchers.routeRules.matchRules.headerMatches.invertMatchresource.pathMatchers.routeRules.matchRules.headerMatches.prefixMatchresource.pathMatchers.routeRules.matchRules.headerMatches.presentMatchresource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatchresource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeStartresource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeEnd
resource.pathMatchers.routeRules.matchRules.headerMatches.regexMatchresource.pathMatchers.routeRules.matchRules.headerMatches.suffixMatchresource.pathMatchers.routeRules.matchRules.ignoreCaseresource.pathMatchers.routeRules.matchRules.metadataFiltersresource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabelsresource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.nameresource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.value
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterMatchCriteriaresource.pathMatchers.routeRules.matchRules.pathTemplateMatchresource.pathMatchers.routeRules.matchRules.prefixMatchresource.pathMatchers.routeRules.matchRules.queryParameterMatchesresource.pathMatchers.routeRules.matchRules.queryParameterMatches.nameresource.pathMatchers.routeRules.matchRules.queryParameterMatches.exactMatchresource.pathMatchers.routeRules.matchRules.queryParameterMatches.presentMatchresource.pathMatchers.routeRules.matchRules.queryParameterMatches.regexMatchresource.pathMatchers.routeRules.matchRules.regexMatch
resource.pathMatchers.routeRules.routeActionresource.pathMatchers.routeRules.routeAction.corsPolicyresource.pathMatchers.routeRules.routeAction.corsPolicy.allowCredentialsresource.pathMatchers.routeRules.routeAction.corsPolicy.allowHeadersresource.pathMatchers.routeRules.routeAction.corsPolicy.allowMethodsresource.pathMatchers.routeRules.routeAction.corsPolicy.allowOriginsresource.pathMatchers.routeRules.routeAction.corsPolicy.allowOriginRegexesresource.pathMatchers.routeRules.routeAction.corsPolicy.disabledresource.pathMatchers.routeRules.routeAction.corsPolicy.exposeHeadersresource.pathMatchers.routeRules.routeAction.corsPolicy.maxAgeresource.pathMatchers.routeRules.routeAction.faultInjectionPolicyresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abortresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.httpStatusresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delayresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.percentageresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelayresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.routeRules.routeAction.maxStreamDurationresource.pathMatchers.routeRules.routeAction.maxStreamDuration.nanosresource.pathMatchers.routeRules.routeAction.maxStreamDuration.secondsresource.pathMatchers.routeRules.routeAction.requestMirrorPolicyresource.pathMatchers.routeRules.routeAction.retryPolicyresource.pathMatchers.routeRules.routeAction.retryPolicy.numRetriesresource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeoutresource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.nanosresource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.routeRules.routeAction.retryPolicy.retryConditionsresource.pathMatchers.routeRules.routeAction.timeoutresource.pathMatchers.routeRules.routeAction.timeout.nanosresource.pathMatchers.routeRules.routeAction.timeout.secondsresource.pathMatchers.routeRules.routeAction.urlRewriteresource.pathMatchers.routeRules.routeAction.urlRewrite.hostRewriteresource.pathMatchers.routeRules.routeAction.urlRewrite.pathPrefixRewriteresource.pathMatchers.routeRules.routeAction.urlRewrite.pathTemplateRewriteresource.pathMatchers.routeRules.routeAction.weightedBackendServicesresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerActionresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAddresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAddresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.weight
resource.pathMatchers.routeRules.urlRedirectresource.pathMatchers.routeRules.urlRedirect.hostRedirectresource.pathMatchers.routeRules.urlRedirect.httpsRedirectresource.pathMatchers.routeRules.urlRedirect.pathRedirectresource.pathMatchers.routeRules.urlRedirect.prefixRedirectresource.pathMatchers.routeRules.urlRedirect.redirectResponseCoderesource.pathMatchers.routeRules.urlRedirect.stripQuery
resource.testsresource.tests.descriptionresource.tests.expectedOutputUrlresource.tests.expectedRedirectResponseCoderesource.tests.headersresource.tests.headers.nameresource.tests.headers.valueresource.tests.hostresource.tests.path
サポートされているその他のコンピューティング リソースについては、Compute Engine のカスタム制約のページをご覧ください。
ポリシーの継承
デフォルトでは、組織のポリシーは、そのポリシーを適用したリソースの子孫に継承されます。たとえば、フォルダにポリシーを適用した場合、 Google Cloud はそのフォルダ内のすべてのプロジェクトにそのポリシーを適用します。この動作の詳細と変更方法については、階層評価ルールをご覧ください。
始める前に
-
まだ設定していない場合は、認証を設定します。認証では、 Google Cloud サービスと API にアクセスするための ID が確認されます。ローカル開発環境からコードまたはサンプルを実行するには、次のいずれかのオプションを選択して Compute Engine に対する認証を行います。
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Google Cloud CLI をインストールします。 インストール後、次のコマンドを実行して Google Cloud CLI を初期化します。
gcloud init外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。
- Set a default region and zone.
- 組織 ID を確認します。
必要なロール
Cloud Load Balancing リソースの組織のポリシーを管理するために必要な権限を取得するには、次の IAM ロールを付与するよう管理者に依頼してください。
-
組織の resource_types に対する組織のポリシー管理者(
roles/orgpolicy.policyAdmin) -
ロード バランシング リソースの制約をテストする: プロジェクト リソースに対する Compute ロードバランサ管理者(v1)(
roles/compute.loadBalancerAdmin.v1)
ロールの付与については、プロジェクト、フォルダ、組織に対するアクセス権の管理をご覧ください。
これらの事前定義ロールには、Cloud Load Balancing リソースの組織のポリシーを管理するために必要な権限が含まれています。必要とされる正確な権限については、「必要な権限」セクションを開いてご確認ください。
必要な権限
Cloud Load Balancing リソースの組織のポリシーを管理するには、次の権限が必要です。
-
orgpolicy.constraints.list -
orgpolicy.policies.create -
orgpolicy.policies.delete -
orgpolicy.policies.list -
orgpolicy.policies.update -
orgpolicy.policy.get -
orgpolicy.policy.set
カスタムロールや他の事前定義ロールを使用して、これらの権限を取得することもできます。
カスタム制約を設定する
カスタム制約は、組織のポリシーを適用しているサービスでサポートされるリソース、メソッド、条件、アクションによって定義されます。カスタム制約の条件は、Common Expression Language(CEL)を使用して定義されます。CEL を使用してカスタム制約で条件を作成する方法については、カスタム組織のポリシーの作成と管理の CEL セクションをご覧ください。
カスタム制約を作成し、 Google Cloud コンソールまたは gcloud CLI を使用して組織のポリシーで使用するように設定できます。
コンソール
Google Cloud コンソールで、[組織のポリシー] ページに移動します。
ページの上部にあるプロジェクト選択ツールを選択します。
[リソースを選択] ウィンドウで、カスタム制約を作成する組織を選択します。
[ カスタム制約] をクリックします。
[表示名] ボックスに制約の名前を入力します。わかりやすい名前を入力してください。このフィールドの最大長は 200 文字です。エラー メッセージで漏えいする可能性があるため、制約名には個人情報(PII)やセンシティブ データを使用しないでください。
[制約 ID] ボックスに、新しいカスタム制約の名前を入力します。カスタム制約は
custom.で始まる必要があり、大文字、小文字、数字のみを含めることができます(例:custom.enforceTCPHealthCheckPort1024)。このフィールドの最大長は 70 文字です。接頭辞はカウントされません(例:organizations/123456789/customConstraints/custom.)。[説明] ボックスに、ポリシー違反が発生したときにエラー メッセージとして表示される制約の説明を入力します。わかりやすい説明を入力してください。このフィールドの最大長は 2,000 文字です。
[リソースの種類] ボックスで、制限するオブジェクトとフィールドを含む Google CloudREST リソースの名前を選択します。例:
compute.googleapis.com/HealthCheck[適用方法] で、REST
CREATEメソッドに制約を適用するかどうかを選択します。条件を定義するには、[ 条件を編集] をクリックします。
[条件を追加] パネルで、サポートされているサービス リソースを参照する CEL 条件を作成します(例:
)。このフィールドの最大長は 1,000 文字です。resource.tcpHealthCheck.port >= 1024[保存] をクリックします。
[アクション] で、前述の条件を満たしている場合に、評価された方法を許可するか拒否するかを選択します。
[制約を作成] をクリックします。
各フィールドに値を入力すると、このカスタム制約の YAML 構成が右側に表示されます。
gcloud
gcloud CLI を使用してカスタム制約を作成するには、カスタム制約の YAML ファイルを作成します。
name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME resource_types: - compute.googleapis.com/RESOURCE_NAME method_types: - CREATE - UPDATE condition: CONDITION action_type: ACTION display_name: DISPLAY_NAME description: DESCRIPTION次のように置き換えます。
ORGANIZATION_ID: 組織 ID(123456789など)。CONSTRAINT_NAME: 新しいカスタム制約に付ける名前。カスタム制約はcustom.で始まる必要があり、大文字、小文字、数字のみを含めることができます。例:custom.enforceTCPHealthCheckPort1024。このフィールドの最大長は 70 文字です。接頭辞はカウントされません(例:organizations/123456789/customConstraints/custom.)。RESOURCE_NAME: 制限するオブジェクトとフィールドを含む Compute Engine API REST リソースの名前(URI ではない)。例:HealthCheckCONDITION: サポート対象のサービス リソースの表現に対して書き込まれる CEL 条件。このフィールドの最大長は 1,000 文字です。条件の書き込み先として使用できるリソースの詳細については、サポート対象のリソースをご覧ください。例:"resource.tcpHealthCheck.port >= 1024"。ACTION:conditionが満たされている場合に実行するアクション。ALLOWまたはDENYになります。DISPLAY_NAME: 制約の名前。わかりやすい名前を入力してください。このフィールドの最大長は 200 文字です。DESCRIPTION: ポリシー違反時にエラー メッセージとして表示される制約の説明。わかりやすい説明を入力してください。このフィールドの最大長は 2,000 文字です。
カスタム制約の作成方法の詳細については、カスタム組織のポリシーの作成と管理をご覧ください。
新しいカスタム制約の YAML ファイルを作成したら、組織内の組織のポリシーで使用できるように設定する必要があります。カスタム制約を設定するには、gcloud org-policies set-custom-constraintコマンドを使用します。gcloud org-policies set-custom-constraint CONSTRAINT_PATH
CONSTRAINT_PATHは、カスタム制約ファイルのフルパスに置き換えます。例:/home/user/customconstraint.yaml完了すると、カスタム制約が組織のポリシーとして Google Cloud 組織のポリシーのリストに表示されます。カスタム制約が存在することを確認するには、gcloud org-policies list-custom-constraintsコマンドを使用します。gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID
ORGANIZATION_IDは、組織リソースの ID に置き換えます。詳細については、組織のポリシーの表示をご覧ください。カスタム制約を適用する
制約を適用するには、それを参照する組織のポリシーを作成し、その組織のポリシーを Google Cloud リソースに適用します。コンソール
- Google Cloud コンソールで [組織のポリシー] ページに移動します。
- プロジェクト選択ツールで、組織のポリシーを設定するプロジェクトを選択します。
- [組織のポリシー] ページのリストで制約を選択して、その制約の [ポリシーの詳細] ページを表示します。
- このリソースの組織のポリシーを構成するには、[ポリシーを管理] をクリックします。
- [ポリシーの編集] ページで、[Override parent's policy] を選択します。
- [ルールを追加] をクリックします。
- [適用] セクションで、この組織のポリシーの適用を有効にするかどうかを選択します。
- 省略可: タグで組織のポリシーに条件を設定するには、[条件を追加] をクリックします。組織のポリシーに条件付きルールを追加する場合は、少なくとも 1 つは無条件のルールを追加する必要があります。そうしないとポリシーを保存できないのでご注意ください。詳細については、タグ付きの組織のポリシーの設定をご覧ください。
- [変更内容をテスト] をクリックして、組織のポリシーの効果をシミュレートします。以前のマネージド制約ではポリシー シミュレーションを使用できません。詳細については、Policy Simulator で組織のポリシーの変更をテストするをご覧ください。
- 組織のポリシーを完成させて適用するには、[ポリシーを設定] をクリックします。ポリシーが有効になるまでに最大 15 分かかります。
gcloud
ブール型ルールを含む組織のポリシーを作成するには、制約を参照するポリシー YAML ファイルを作成します。
name: projects/PROJECT_ID/policies/CONSTRAINT_NAME spec: rules: - enforce: true
次のように置き換えます。
-
PROJECT_ID: 制約を適用するプロジェクト。 -
CONSTRAINT_NAME: カスタム制約に定義した名前。たとえば、のようにします。custom.enforceTCPHealthCheckPort1024
制約を含む組織のポリシーを適用するには、次のコマンドを実行します。
-