gcp.projects.Service
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const project = new gcp.projects.Service("project", {
project: "your-project-id",
service: "iam.googleapis.com",
disableOnDestroy: false,
});
import pulumi
import pulumi_gcp as gcp
project = gcp.projects.Service("project",
project="your-project-id",
service="iam.googleapis.com",
disable_on_destroy=False)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := projects.NewService(ctx, "project", &projects.ServiceArgs{
Project: pulumi.String("your-project-id"),
Service: pulumi.String("iam.googleapis.com"),
DisableOnDestroy: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var project = new Gcp.Projects.Service("project", new()
{
Project = "your-project-id",
ServiceName = "iam.googleapis.com",
DisableOnDestroy = false,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.projects.Service;
import com.pulumi.gcp.projects.ServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var project = new Service("project", ServiceArgs.builder()
.project("your-project-id")
.service("iam.googleapis.com")
.disableOnDestroy(false)
.build());
}
}
resources:
project:
type: gcp:projects:Service
properties:
project: your-project-id
service: iam.googleapis.com
disableOnDestroy: false
Create Service Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);
@overload
def Service(resource_name: str,
args: ServiceArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Service(resource_name: str,
opts: Optional[ResourceOptions] = None,
service: Optional[str] = None,
check_if_service_has_usage_on_destroy: Optional[bool] = None,
disable_dependent_services: Optional[bool] = None,
disable_on_destroy: Optional[bool] = None,
project: Optional[str] = None)
func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)
public Service(String name, ServiceArgs args)
public Service(String name, ServiceArgs args, CustomResourceOptions options)
type: gcp:projects:Service
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ServiceArgs
- 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 ServiceArgs
- 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 ServiceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceArgs
- 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 exampleserviceResourceResourceFromProjectsservice = new Gcp.Projects.Service("exampleserviceResourceResourceFromProjectsservice", new()
{
ServiceName = "string",
CheckIfServiceHasUsageOnDestroy = false,
DisableDependentServices = false,
DisableOnDestroy = false,
Project = "string",
});
example, err := projects.NewService(ctx, "exampleserviceResourceResourceFromProjectsservice", &projects.ServiceArgs{
Service: pulumi.String("string"),
CheckIfServiceHasUsageOnDestroy: pulumi.Bool(false),
DisableDependentServices: pulumi.Bool(false),
DisableOnDestroy: pulumi.Bool(false),
Project: pulumi.String("string"),
})
var exampleserviceResourceResourceFromProjectsservice = new Service("exampleserviceResourceResourceFromProjectsservice", ServiceArgs.builder()
.service("string")
.checkIfServiceHasUsageOnDestroy(false)
.disableDependentServices(false)
.disableOnDestroy(false)
.project("string")
.build());
exampleservice_resource_resource_from_projectsservice = gcp.projects.Service("exampleserviceResourceResourceFromProjectsservice",
service="string",
check_if_service_has_usage_on_destroy=False,
disable_dependent_services=False,
disable_on_destroy=False,
project="string")
const exampleserviceResourceResourceFromProjectsservice = new gcp.projects.Service("exampleserviceResourceResourceFromProjectsservice", {
service: "string",
checkIfServiceHasUsageOnDestroy: false,
disableDependentServices: false,
disableOnDestroy: false,
project: "string",
});
type: gcp:projects:Service
properties:
checkIfServiceHasUsageOnDestroy: false
disableDependentServices: false
disableOnDestroy: false
project: string
service: string
Service 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 Service resource accepts the following input properties:
- Service
Name string - The service to enable.
- Check
If boolService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - Disable
Dependent boolServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - Disable
On boolDestroy - Project string
- The project ID. If not provided, the provider project is used.
- Service string
- The service to enable.
- Check
If boolService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - Disable
Dependent boolServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - Disable
On boolDestroy - Project string
- The project ID. If not provided, the provider project is used.
- service String
- The service to enable.
- check
If BooleanService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable
Dependent BooleanServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable
On BooleanDestroy - project String
- The project ID. If not provided, the provider project is used.
- service string
- The service to enable.
- check
If booleanService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable
Dependent booleanServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable
On booleanDestroy - project string
- The project ID. If not provided, the provider project is used.
- service str
- The service to enable.
- check_
if_ boolservice_ has_ usage_ on_ destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable_
dependent_ boolservices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable_
on_ booldestroy - project str
- The project ID. If not provided, the provider project is used.
- service String
- The service to enable.
- check
If BooleanService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable
Dependent BooleanServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable
On BooleanDestroy - project String
- The project ID. If not provided, the provider project is used.
Outputs
All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Service Resource
Get an existing Service 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?: ServiceState, opts?: CustomResourceOptions): Service
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
check_if_service_has_usage_on_destroy: Optional[bool] = None,
disable_dependent_services: Optional[bool] = None,
disable_on_destroy: Optional[bool] = None,
project: Optional[str] = None,
service: Optional[str] = None) -> Service
func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)
public static Service Get(string name, Input<string> id, ServiceState? state, CustomResourceOptions? opts = null)
public static Service get(String name, Output<String> id, ServiceState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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
If boolService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - Disable
Dependent boolServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - Disable
On boolDestroy - Project string
- The project ID. If not provided, the provider project is used.
- Service
Name string - The service to enable.
- Check
If boolService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - Disable
Dependent boolServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - Disable
On boolDestroy - Project string
- The project ID. If not provided, the provider project is used.
- Service string
- The service to enable.
- check
If BooleanService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable
Dependent BooleanServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable
On BooleanDestroy - project String
- The project ID. If not provided, the provider project is used.
- service String
- The service to enable.
- check
If booleanService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable
Dependent booleanServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable
On booleanDestroy - project string
- The project ID. If not provided, the provider project is used.
- service string
- The service to enable.
- check_
if_ boolservice_ has_ usage_ on_ destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable_
dependent_ boolservices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable_
on_ booldestroy - project str
- The project ID. If not provided, the provider project is used.
- service str
- The service to enable.
- check
If BooleanService Has Usage On Destroy - Beta
If
true
, the usage of the service to be disabled will be checked and an error will be returned if the service to be disabled has usage in last 30 days. Defaults tofalse
. - disable
Dependent BooleanServices - If
true
, services that are enabled and which depend on this service should also be disabled when this service is destroyed. Iffalse
or unset, an error will be generated if any enabled services depend on this service when destroying it. - disable
On BooleanDestroy - project String
- The project ID. If not provided, the provider project is used.
- service String
- The service to enable.
Import
Project services can be imported using the project_id
and service
, e.g.
{{project_id}}/{{service}}
When using the pulumi import
command, project services can be imported using one of the formats above. For example:
$ pulumi import gcp:projects/service:Service default {{project_id}}/{{service}}
Note that unlike other resources that fail if they already exist,
pulumi up
can be successfully used to verify already enabled services.
This means that when importing existing resources into Terraform, you can either
import the google_project_service
resources or treat them as new
infrastructure and run pulumi up
to add them to state.
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-beta
Terraform Provider.