Namespace Pulumi.Gcp.CloudRun
Classes
DomainMapping
Resource to hold the state and status of a user's domain mapping.
To get more information about DomainMapping, see:
- API documentation
- How-to Guides
- Official Documentation
Example Usage - Cloud Run Domain Mapping Basic
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var defaultService = new Gcp.CloudRun.Service("defaultService", new Gcp.CloudRun.ServiceArgs
{
Location = "us-central1",
Metadata = new Gcp.CloudRun.Inputs.ServiceMetadataArgs
{
Namespace = "my-project-name",
},
Template = new Gcp.CloudRun.Inputs.ServiceTemplateArgs
{
Spec = new Gcp.CloudRun.Inputs.ServiceTemplateSpecArgs
{
Containers =
{
new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs
{
Image = "gcr.io/cloudrun/hello",
},
},
},
},
});
var defaultDomainMapping = new Gcp.CloudRun.DomainMapping("defaultDomainMapping", new Gcp.CloudRun.DomainMappingArgs
{
Location = "us-central1",
Metadata = new Gcp.CloudRun.Inputs.DomainMappingMetadataArgs
{
Namespace = "my-project-name",
},
Spec = new Gcp.CloudRun.Inputs.DomainMappingSpecArgs
{
RouteName = defaultService.Name,
},
});
}
}
DomainMappingArgs
DomainMappingState
IamBinding
Three different resources help you manage your IAM policy for Cloud Run Service. Each of these resources serves a different use case:
gcp.cloudrun.IamPolicy: Authoritative. Sets the IAM policy for the service and replaces any existing policy already attached.gcp.cloudrun.IamBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service are preserved.gcp.cloudrun.IamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the service are preserved.
Note:
gcp.cloudrun.IamPolicycannot be used in conjunction withgcp.cloudrun.IamBindingandgcp.cloudrun.IamMemberor they will fight over what your policy should be.
Note:
gcp.cloudrun.IamBindingresources can be used in conjunction withgcp.cloudrun.IamMemberresources only if they do not grant privilege to the same role.
google_cloud_run_service_iam_policy
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
{
Binding =
{
{
{ "role", "roles/viewer" },
{ "members",
{
"user:jane@example.com",
} },
},
},
}));
var policy = new Gcp.CloudRun.IamPolicy("policy", new Gcp.CloudRun.IamPolicyArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
PolicyData = admin.Apply(admin => admin.PolicyData),
});
}
}
google_cloud_run_service_iam_binding
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var binding = new Gcp.CloudRun.IamBinding("binding", new Gcp.CloudRun.IamBindingArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
Role = "roles/viewer",
Members =
{
"user:jane@example.com",
},
});
}
}
google_cloud_run_service_iam_member
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var member = new Gcp.CloudRun.IamMember("member", new Gcp.CloudRun.IamMemberArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
Role = "roles/viewer",
Member = "user:jane@example.com",
});
}
}
IamBindingArgs
IamBindingState
IamMember
Three different resources help you manage your IAM policy for Cloud Run Service. Each of these resources serves a different use case:
gcp.cloudrun.IamPolicy: Authoritative. Sets the IAM policy for the service and replaces any existing policy already attached.gcp.cloudrun.IamBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service are preserved.gcp.cloudrun.IamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the service are preserved.
Note:
gcp.cloudrun.IamPolicycannot be used in conjunction withgcp.cloudrun.IamBindingandgcp.cloudrun.IamMemberor they will fight over what your policy should be.
Note:
gcp.cloudrun.IamBindingresources can be used in conjunction withgcp.cloudrun.IamMemberresources only if they do not grant privilege to the same role.
google_cloud_run_service_iam_policy
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
{
Binding =
{
{
{ "role", "roles/viewer" },
{ "members",
{
"user:jane@example.com",
} },
},
},
}));
var policy = new Gcp.CloudRun.IamPolicy("policy", new Gcp.CloudRun.IamPolicyArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
PolicyData = admin.Apply(admin => admin.PolicyData),
});
}
}
google_cloud_run_service_iam_binding
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var binding = new Gcp.CloudRun.IamBinding("binding", new Gcp.CloudRun.IamBindingArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
Role = "roles/viewer",
Members =
{
"user:jane@example.com",
},
});
}
}
google_cloud_run_service_iam_member
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var member = new Gcp.CloudRun.IamMember("member", new Gcp.CloudRun.IamMemberArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
Role = "roles/viewer",
Member = "user:jane@example.com",
});
}
}
IamMemberArgs
IamMemberState
IamPolicy
Three different resources help you manage your IAM policy for Cloud Run Service. Each of these resources serves a different use case:
gcp.cloudrun.IamPolicy: Authoritative. Sets the IAM policy for the service and replaces any existing policy already attached.gcp.cloudrun.IamBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service are preserved.gcp.cloudrun.IamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the service are preserved.
Note:
gcp.cloudrun.IamPolicycannot be used in conjunction withgcp.cloudrun.IamBindingandgcp.cloudrun.IamMemberor they will fight over what your policy should be.
Note:
gcp.cloudrun.IamBindingresources can be used in conjunction withgcp.cloudrun.IamMemberresources only if they do not grant privilege to the same role.
google_cloud_run_service_iam_policy
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
{
Binding =
{
{
{ "role", "roles/viewer" },
{ "members",
{
"user:jane@example.com",
} },
},
},
}));
var policy = new Gcp.CloudRun.IamPolicy("policy", new Gcp.CloudRun.IamPolicyArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
PolicyData = admin.Apply(admin => admin.PolicyData),
});
}
}
google_cloud_run_service_iam_binding
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var binding = new Gcp.CloudRun.IamBinding("binding", new Gcp.CloudRun.IamBindingArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
Role = "roles/viewer",
Members =
{
"user:jane@example.com",
},
});
}
}
google_cloud_run_service_iam_member
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var member = new Gcp.CloudRun.IamMember("member", new Gcp.CloudRun.IamMemberArgs
{
Location = google_cloud_run_service.Default.Location,
Project = google_cloud_run_service.Default.Project,
Service = google_cloud_run_service.Default.Name,
Role = "roles/viewer",
Member = "user:jane@example.com",
});
}
}
IamPolicyArgs
IamPolicyState
Service
Service acts as a top-level container that manages a set of Routes and Configurations which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership. Service acts only as an orchestrator of the underlying Routes and Configurations (much as a kubernetes Deployment orchestrates ReplicaSets).
The Service's controller will track the statuses of its owned Configuration and Route, reflecting their statuses and conditions as its own.
See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#service
To get more information about Service, see:
- API documentation
- How-to Guides
- Official Documentation
Example Usage
Cloud Run Service Basic
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var @default = new Gcp.CloudRun.Service("default", new Gcp.CloudRun.ServiceArgs
{
Location = "us-central1",
Template = new Gcp.CloudRun.Inputs.ServiceTemplateArgs
{
Spec = new Gcp.CloudRun.Inputs.ServiceTemplateSpecArgs
{
Containers =
{
new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs
{
Image = "gcr.io/cloudrun/hello",
},
},
},
},
Traffics =
{
new Gcp.CloudRun.Inputs.ServiceTrafficArgs
{
LatestRevision = true,
Percent = 100,
},
},
});
}
}
Cloud Run Service Sql
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var instance = new Gcp.Sql.DatabaseInstance("instance", new Gcp.Sql.DatabaseInstanceArgs
{
Region = "us-east1",
Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
{
Tier = "db-f1-micro",
},
});
var @default = new Gcp.CloudRun.Service("default", new Gcp.CloudRun.ServiceArgs
{
AutogenerateRevisionName = true,
Location = "us-central1",
Template = new Gcp.CloudRun.Inputs.ServiceTemplateArgs
{
Metadata = new Gcp.CloudRun.Inputs.ServiceTemplateMetadataArgs
{
Annotations =
{
{ "autoscaling.knative.dev/maxScale", "1000" },
{ "run.googleapis.com/client-name", "demo" },
{ "run.googleapis.com/cloudsql-instances", instance.Name.Apply(name => $"my-project-name:us-central1:{name}") },
},
},
Spec = new Gcp.CloudRun.Inputs.ServiceTemplateSpecArgs
{
Containers =
{
new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs
{
Image = "gcr.io/cloudrun/hello",
},
},
},
},
});
}
}
Cloud Run Service Multiple Environment Variables
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var @default = new Gcp.CloudRun.Service("default", new Gcp.CloudRun.ServiceArgs
{
AutogenerateRevisionName = true,
Location = "us-central1",
Template = new Gcp.CloudRun.Inputs.ServiceTemplateArgs
{
Spec = new Gcp.CloudRun.Inputs.ServiceTemplateSpecArgs
{
Containers =
{
new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs
{
Env =
{
{
{ "name", "SOURCE" },
{ "value", "remote" },
},
{
{ "name", "TARGET" },
{ "value", "home" },
},
},
Image = "gcr.io/cloudrun/hello",
},
},
},
},
Traffics =
{
new Gcp.CloudRun.Inputs.ServiceTrafficArgs
{
LatestRevision = true,
Percent = 100,
},
},
});
}
}
Example Usage - Cloud Run Service Traffic Split
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var @default = new Gcp.CloudRun.Service("default", new Gcp.CloudRun.ServiceArgs
{
Location = "us-central1",
Template = new Gcp.CloudRun.Inputs.ServiceTemplateArgs
{
Metadata = new Gcp.CloudRun.Inputs.ServiceTemplateMetadataArgs
{
Name = "cloudrun-srv-green",
},
Spec = new Gcp.CloudRun.Inputs.ServiceTemplateSpecArgs
{
Containers =
{
new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs
{
Image = "gcr.io/cloudrun/hello",
},
},
},
},
Traffics =
{
new Gcp.CloudRun.Inputs.ServiceTrafficArgs
{
Percent = 25,
RevisionName = "cloudrun-srv-green",
},
new Gcp.CloudRun.Inputs.ServiceTrafficArgs
{
Percent = 75,
RevisionName = "cloudrun-srv-blue",
},
},
});
}
}