published on Tuesday, Oct 20, 2026 by Pulumi
published on Tuesday, Oct 20, 2026 by Pulumi
Consumer Policy is a set of rules that define what services or service groups can be used for a cloud resource hierarchy.
Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
To get more information about ConsumerPolicy, see:
- API documentation
- How-to Guides
Create V2ConsumerPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new V2ConsumerPolicy(name: string, args: V2ConsumerPolicyArgs, opts?: CustomResourceOptions);@overload
def V2ConsumerPolicy(resource_name: str,
args: V2ConsumerPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def V2ConsumerPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
enable_rules: Optional[Sequence[V2ConsumerPolicyEnableRuleArgs]] = None,
parent: Optional[str] = None,
check_usage_on_remove: Optional[bool] = None,
deletion_policy: Optional[str] = None,
name: Optional[str] = None,
validate_dependencies: Optional[bool] = None)func NewV2ConsumerPolicy(ctx *Context, name string, args V2ConsumerPolicyArgs, opts ...ResourceOption) (*V2ConsumerPolicy, error)public V2ConsumerPolicy(string name, V2ConsumerPolicyArgs args, CustomResourceOptions? opts = null)
public V2ConsumerPolicy(String name, V2ConsumerPolicyArgs args)
public V2ConsumerPolicy(String name, V2ConsumerPolicyArgs args, CustomResourceOptions options)
type: gcp:serviceusage:V2ConsumerPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "gcp_serviceusage_v2_consumer_policy" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args V2ConsumerPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args V2ConsumerPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args V2ConsumerPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args V2ConsumerPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args V2ConsumerPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var v2consumerPolicyResource = new Gcp.ServiceUsage.V2ConsumerPolicy("v2consumerPolicyResource", new()
{
EnableRules = new[]
{
new Gcp.ServiceUsage.Inputs.V2ConsumerPolicyEnableRuleArgs
{
Services = new[]
{
"string",
},
},
},
Parent = "string",
CheckUsageOnRemove = false,
DeletionPolicy = "string",
Name = "string",
ValidateDependencies = false,
});
example, err := serviceusage.NewV2ConsumerPolicy(ctx, "v2consumerPolicyResource", &serviceusage.V2ConsumerPolicyArgs{
EnableRules: serviceusage.V2ConsumerPolicyEnableRuleArray{
&serviceusage.V2ConsumerPolicyEnableRuleArgs{
Services: pulumi.StringArray{
pulumi.String("string"),
},
},
},
Parent: pulumi.String("string"),
CheckUsageOnRemove: pulumi.Bool(false),
DeletionPolicy: pulumi.String("string"),
Name: pulumi.String("string"),
ValidateDependencies: pulumi.Bool(false),
})
resource "gcp_serviceusage_v2_consumer_policy" "v2consumerPolicyResource" {
lifecycle {
create_before_destroy = true
}
enable_rules {
services = ["string"]
}
parent = "string"
check_usage_on_remove = false
deletion_policy = "string"
name = "string"
validate_dependencies = false
}
var v2consumerPolicyResource = new V2ConsumerPolicy("v2consumerPolicyResource", V2ConsumerPolicyArgs.builder()
.enableRules(V2ConsumerPolicyEnableRuleArgs.builder()
.services("string")
.build())
.parent("string")
.checkUsageOnRemove(false)
.deletionPolicy("string")
.name("string")
.validateDependencies(false)
.build());
v2consumer_policy_resource = gcp.serviceusage.V2ConsumerPolicy("v2consumerPolicyResource",
enable_rules=[{
"services": ["string"],
}],
parent="string",
check_usage_on_remove=False,
deletion_policy="string",
name="string",
validate_dependencies=False)
const v2consumerPolicyResource = new gcp.serviceusage.V2ConsumerPolicy("v2consumerPolicyResource", {
enableRules: [{
services: ["string"],
}],
parent: "string",
checkUsageOnRemove: false,
deletionPolicy: "string",
name: "string",
validateDependencies: false,
});
type: gcp:serviceusage:V2ConsumerPolicy
properties:
checkUsageOnRemove: false
deletionPolicy: string
enableRules:
- services:
- string
name: string
parent: string
validateDependencies: false
V2ConsumerPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The V2ConsumerPolicy resource accepts the following input properties:
- Enable
Rules List<V2ConsumerPolicy Enable Rule> - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- Parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- Check
Usage boolOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Name string
- The name of the policy. Currently only the “default” policy name is supported.
- Validate
Dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- Enable
Rules []V2ConsumerPolicy Enable Rule Args - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- Parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- Check
Usage boolOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Name string
- The name of the policy. Currently only the “default” policy name is supported.
- Validate
Dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- enable_
rules list(object) - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- check_
usage_ boolon_ remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion_
policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- name string
- The name of the policy. Currently only the “default” policy name is supported.
- validate_
dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- enable
Rules List<V2ConsumerPolicy Enable Rule> - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- parent String
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- check
Usage BooleanOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- name String
- The name of the policy. Currently only the “default” policy name is supported.
- validate
Dependencies Boolean - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- enable
Rules V2ConsumerPolicy Enable Rule[] - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- check
Usage booleanOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- name string
- The name of the policy. Currently only the “default” policy name is supported.
- validate
Dependencies boolean - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- enable_
rules Sequence[V2ConsumerPolicy Enable Rule Args] - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- parent str
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- check_
usage_ boolon_ remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion_
policy str - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- name str
- The name of the policy. Currently only the “default” policy name is supported.
- validate_
dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- enable
Rules List<Property Map> - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- parent String
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- check
Usage BooleanOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- name String
- The name of the policy. Currently only the “default” policy name is supported.
- validate
Dependencies Boolean - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
Outputs
All input properties are implicitly available as output properties. Additionally, the V2ConsumerPolicy resource produces the following output properties:
Look up Existing V2ConsumerPolicy Resource
Get an existing V2ConsumerPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: V2ConsumerPolicyState, opts?: CustomResourceOptions): V2ConsumerPolicy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
check_usage_on_remove: Optional[bool] = None,
deletion_policy: Optional[str] = None,
enable_rules: Optional[Sequence[V2ConsumerPolicyEnableRuleArgs]] = None,
etag: Optional[str] = None,
name: Optional[str] = None,
parent: Optional[str] = None,
validate_dependencies: Optional[bool] = None) -> V2ConsumerPolicyfunc GetV2ConsumerPolicy(ctx *Context, name string, id IDInput, state *V2ConsumerPolicyState, opts ...ResourceOption) (*V2ConsumerPolicy, error)public static V2ConsumerPolicy Get(string name, Input<string> id, V2ConsumerPolicyState? state, CustomResourceOptions? opts = null)public static V2ConsumerPolicy get(String name, Output<String> id, V2ConsumerPolicyState state, CustomResourceOptions options)resources: _: type: gcp:serviceusage:V2ConsumerPolicy get: id: ${id}import {
to = gcp_serviceusage_v2_consumer_policy.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Check
Usage boolOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Enable
Rules List<V2ConsumerPolicy Enable Rule> - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- Etag string
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- Name string
- The name of the policy. Currently only the “default” policy name is supported.
- Parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- Validate
Dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- Check
Usage boolOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Enable
Rules []V2ConsumerPolicy Enable Rule Args - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- Etag string
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- Name string
- The name of the policy. Currently only the “default” policy name is supported.
- Parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- Validate
Dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- check_
usage_ boolon_ remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion_
policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- enable_
rules list(object) - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- etag string
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- name string
- The name of the policy. Currently only the “default” policy name is supported.
- parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- validate_
dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- check
Usage BooleanOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- enable
Rules List<V2ConsumerPolicy Enable Rule> - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- etag String
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- name String
- The name of the policy. Currently only the “default” policy name is supported.
- parent String
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- validate
Dependencies Boolean - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- check
Usage booleanOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- enable
Rules V2ConsumerPolicy Enable Rule[] - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- etag string
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- name string
- The name of the policy. Currently only the “default” policy name is supported.
- parent string
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- validate
Dependencies boolean - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- check_
usage_ boolon_ remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion_
policy str - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- enable_
rules Sequence[V2ConsumerPolicy Enable Rule Args] - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- etag str
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- name str
- The name of the policy. Currently only the “default” policy name is supported.
- parent str
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- validate_
dependencies bool - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
- check
Usage BooleanOn Remove - (Optional) Default value is false. If true, the usage of the service to be removed will be checked. If the service has been used within the past 30 days or was enabled in the last 3 days, an error will be thrown.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- enable
Rules List<Property Map> - The consumer policy rule that defines enabled services. The structure is documented below. Structure is documented below.
- etag String
- Entity tag (ETag) used for optimistic concurrency control as a way to help prevent simultaneous updates from overwriting each other. Used internally during updates.
- name String
- The name of the policy. Currently only the “default” policy name is supported.
- parent String
- The name of the parent. It can be a project, folder or organization in the format of projects/<project_id or project_number>, folders/<folder_number> or organizations/<org_number> .
- validate
Dependencies Boolean - (Optional) Default value is true. If true, this flag enforces dependency management within the consumer policy. When adding a new service, it verifies that all its dependencies are already present/added in the policy. Conversely, when removing a service, it ensures that no other services within the policy depend on the service to be removed. If the validation fails, a comprehensive message will be presented, outlining the missing dependencies and providing instructions on how to address the issue.
Supporting Types
V2ConsumerPolicyEnableRule, V2ConsumerPolicyEnableRuleArgs
- Services List<string>
- (Optional): List of service names to be enabled in the format of services/<service_name>
- Services []string
- (Optional): List of service names to be enabled in the format of services/<service_name>
- services list(string)
- (Optional): List of service names to be enabled in the format of services/<service_name>
- services List<String>
- (Optional): List of service names to be enabled in the format of services/<service_name>
- services string[]
- (Optional): List of service names to be enabled in the format of services/<service_name>
- services Sequence[str]
- (Optional): List of service names to be enabled in the format of services/<service_name>
- services List<String>
- (Optional): List of service names to be enabled in the format of services/<service_name>
Import
ConsumerPolicy can be imported using any of these accepted formats:
{{parent}}/consumerPolicies/{{name}}
When using the pulumi import command, ConsumerPolicy can be imported using one of the formats above. For example:
$ pulumi import gcp:serviceusage/v2ConsumerPolicy:V2ConsumerPolicy default {{parent}}/consumerPolicies/{{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
published on Tuesday, Oct 20, 2026 by Pulumi