GoogleApiSource class
The Eventarc GoogleApiSource resource
To get more information about GoogleApiSource, see:
- API documentation
- How-to Guides
- Official Documentation
Example Usage
Eventarc Google Api Source With Cmek
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const testProject = gcp.organizations.getProject({
projectId: "my-project-name",
});
const testKeyRing = gcp.kms.getKMSKeyRing({
name: "keyring",
location: "us-central1",
});
const key = testKeyRing.then(testKeyRing => gcp.kms.getKMSCryptoKey({
name: "key",
keyRing: testKeyRing.id,
}));
const keyMember = new gcp.kms.CryptoKeyIAMMember("key_member", {
cryptoKeyId: key.then(key => key.id),
role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
member: testProject.then(testProject => `serviceAccount:service-${testProject.number}@gcp-sa-eventarc.iam.gserviceaccount.com`),
});
const messageBus = new gcp.eventarc.MessageBus("message_bus", {
location: "us-central1",
messageBusId: "some-message-bus",
});
const primary = new gcp.eventarc.GoogleApiSource("primary", {
location: "us-central1",
googleApiSourceId: "some-google-api-source",
destination: messageBus.id,
cryptoKeyName: key.then(key => key.id),
}, {
dependsOn: [keyMember],
});
import pulumi
import pulumi_gcp as gcp
test_project = gcp.organizations.get_project(project_id="my-project-name")
test_key_ring = gcp.kms.get_kms_key_ring(name="keyring",
location="us-central1")
key = gcp.kms.get_kms_crypto_key(name="key",
key_ring=test_key_ring.id)
key_member = gcp.kms.CryptoKeyIAMMember("key_member",
crypto_key_id=key.id,
role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
member=f"serviceAccount:service-{test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com")
message_bus = gcp.eventarc.MessageBus("message_bus",
location="us-central1",
message_bus_id="some-message-bus")
primary = gcp.eventarc.GoogleApiSource("primary",
location="us-central1",
google_api_source_id="some-google-api-source",
destination=message_bus.id,
crypto_key_name=key.id,
opts = pulumi.ResourceOptions(depends_on=[key_member]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var testProject = Gcp.Organizations.GetProject.Invoke(new()
{
ProjectId = "my-project-name",
});
var testKeyRing = Gcp.Kms.GetKMSKeyRing.Invoke(new()
{
Name = "keyring",
Location = "us-central1",
});
var key = Gcp.Kms.GetKMSCryptoKey.Invoke(new()
{
Name = "key",
KeyRing = testKeyRing.Apply(getKMSKeyRingResult => getKMSKeyRingResult.Id),
});
var keyMember = new Gcp.Kms.CryptoKeyIAMMember("key_member", new()
{
CryptoKeyId = key.Apply(getKMSCryptoKeyResult => getKMSCryptoKeyResult.Id),
Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
Member = $"serviceAccount:service-{testProject.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-eventarc.iam.gserviceaccount.com",
});
var messageBus = new Gcp.Eventarc.MessageBus("message_bus", new()
{
Location = "us-central1",
MessageBusId = "some-message-bus",
});
var primary = new Gcp.Eventarc.GoogleApiSource("primary", new()
{
Location = "us-central1",
GoogleApiSourceId = "some-google-api-source",
Destination = messageBus.Id,
CryptoKeyName = key.Apply(getKMSCryptoKeyResult => getKMSCryptoKeyResult.Id),
}, new CustomResourceOptions
{
DependsOn =
{
keyMember,
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/eventarc"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/kms"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testProject, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{
ProjectId: pulumi.StringRef("my-project-name"),
}, nil)
if err != nil {
return err
}
testKeyRing, err := kms.GetKMSKeyRing(ctx, &kms.GetKMSKeyRingArgs{
Name: "keyring",
Location: "us-central1",
}, nil)
if err != nil {
return err
}
key, err := kms.GetKMSCryptoKey(ctx, &kms.GetKMSCryptoKeyArgs{
Name: "key",
KeyRing: testKeyRing.Id,
}, nil)
if err != nil {
return err
}
keyMember, err := kms.NewCryptoKeyIAMMember(ctx, "key_member", &kms.CryptoKeyIAMMemberArgs{
CryptoKeyId: pulumi.String(key.Id),
Role: pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
Member: pulumi.Sprintf("serviceAccount:service-%v@gcp-sa-eventarc.iam.gserviceaccount.com", testProject.Number),
})
if err != nil {
return err
}
messageBus, err := eventarc.NewMessageBus(ctx, "message_bus", &eventarc.MessageBusArgs{
Location: pulumi.String("us-central1"),
MessageBusId: pulumi.String("some-message-bus"),
})
if err != nil {
return err
}
_, err = eventarc.NewGoogleApiSource(ctx, "primary", &eventarc.GoogleApiSourceArgs{
Location: pulumi.String("us-central1"),
GoogleApiSourceId: pulumi.String("some-google-api-source"),
Destination: messageBus.ID().ToIDOutput().ToStringOutput(),
CryptoKeyName: pulumi.String(key.Id),
}, pulumi.DependsOn([]pulumi.Resource{
keyMember,
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
data "gcp_organizations_getproject" "testProject" {
project_id = "my-project-name"
}
data "gcp_kms_getkmskeyring" "testKeyRing" {
name = "keyring"
location = "us-central1"
}
data "gcp_kms_getkmscryptokey" "key" {
name = "key"
key_ring = data.gcp_kms_getkmskeyring.testKeyRing.id
}
resource "gcp_kms_cryptokeyiammember" "key_member" {
crypto_key_id = data.gcp_kms_getkmscryptokey.key.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
member ="serviceAccount:service-${data.gcp_organizations_getproject.testProject.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "gcp_eventarc_messagebus" "message_bus" {
location = "us-central1"
message_bus_id = "some-message-bus"
}
resource "gcp_eventarc_googleapisource" "primary" {
depends_on = [gcp_kms_cryptokeyiammember.key_member]
location = "us-central1"
google_api_source_id = "some-google-api-source"
destination = gcp_eventarc_messagebus.message_bus.id
crypto_key_name = data.gcp_kms_getkmscryptokey.key.id
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.kms.KmsFunctions;
import com.pulumi.gcp.kms.inputs.GetKMSKeyRingArgs;
import com.pulumi.gcp.kms.inputs.GetKMSCryptoKeyArgs;
import com.pulumi.gcp.kms.CryptoKeyIAMMember;
import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
import com.pulumi.gcp.eventarc.MessageBus;
import com.pulumi.gcp.eventarc.MessageBusArgs;
import com.pulumi.gcp.eventarc.GoogleApiSource;
import com.pulumi.gcp.eventarc.GoogleApiSourceArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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) {
final var testProject = OrganizationsFunctions.getProject(GetProjectArgs.builder()
.projectId("my-project-name")
.build());
final var testKeyRing = KmsFunctions.getKMSKeyRing(GetKMSKeyRingArgs.builder()
.name("keyring")
.location("us-central1")
.build());
final var key = KmsFunctions.getKMSCryptoKey(GetKMSCryptoKeyArgs.builder()
.name("key")
.keyRing(testKeyRing.id())
.build());
var keyMember = new CryptoKeyIAMMember("keyMember", CryptoKeyIAMMemberArgs.builder()
.cryptoKeyId(key.id())
.role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
.member(String.format("serviceAccount:service-%s@gcp-sa-eventarc.iam.gserviceaccount.com", testProject.number()))
.build());
var messageBus = new MessageBus("messageBus", MessageBusArgs.builder()
.location("us-central1")
.messageBusId("some-message-bus")
.build());
var primary = new GoogleApiSource("primary", GoogleApiSourceArgs.builder()
.location("us-central1")
.googleApiSourceId("some-google-api-source")
.destination(messageBus.id())
.cryptoKeyName(key.id())
.build(), CustomResourceOptions.builder()
.dependsOn(keyMember)
.build());
}
}
resources:
keyMember:
type: gcp:kms:CryptoKeyIAMMember
name: key_member
properties:
cryptoKeyId: ${key.id}
role: roles/cloudkms.cryptoKeyEncrypterDecrypter
member: serviceAccount:service-${testProject.number}@gcp-sa-eventarc.iam.gserviceaccount.com
messageBus:
type: gcp:eventarc:MessageBus
name: message_bus
properties:
location: us-central1
messageBusId: some-message-bus
primary:
type: gcp:eventarc:GoogleApiSource
properties:
location: us-central1
googleApiSourceId: some-google-api-source
destination: ${messageBus.id}
cryptoKeyName: ${key.id}
options:
dependsOn:
- ${keyMember}
variables:
testProject:
fn::invoke:
function: gcp:organizations:getProject
arguments:
projectId: my-project-name
testKeyRing:
fn::invoke:
function: gcp:kms:getKMSKeyRing
arguments:
name: keyring
location: us-central1
key:
fn::invoke:
function: gcp:kms:getKMSCryptoKey
arguments:
name: key
keyRing: ${testKeyRing.id}
Import
GoogleApiSource can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/googleApiSources/{{google_api_source_id}}{{project}}/{{location}}/{{google_api_source_id}}{{location}}/{{google_api_source_id}}
When using the pulumi import command, GoogleApiSource can be imported using one of the formats above. For example:
$ pulumi import gcp:eventarc/googleApiSource:GoogleApiSource default projects/{{project}}/locations/{{location}}/googleApiSources/{{google_api_source_id}}
$ pulumi import gcp:eventarc/googleApiSource:GoogleApiSource default {{project}}/{{location}}/{{google_api_source_id}}
$ pulumi import gcp:eventarc/googleApiSource:GoogleApiSource default {{location}}/{{google_api_source_id}}
Constructors
- GoogleApiSource(String name, {GoogleApiSourceArgs? args, CustomResourceOptions? options})
-
Creates a new GoogleApiSource.
nameThe Pulumi resource name.argsArguments used to configure this GoogleApiSource. The set of arguments for GoogleApiSource.optionsResource options controlling this resource's behavior. - GoogleApiSource.reference(String urn)
- Creates a typed reference to an existing GoogleApiSource resource.
Properties
-
annotations
↔ Output<
Map< String, String> ?> -
Resource annotations.
Note: This field is non-authoritative, and will only manage the annotations present in your configuration.
Please refer to the field
effectiveAnnotationsfor all of the annotations present on the resource.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
createTime
↔ Output<
String> -
The creation time.
latefinal
-
cryptoKeyName
↔ Output<
String?> -
Resource name of a KMS crypto key (managed by the user) used to
encrypt/decrypt their event data.
It must match the pattern
projects/*/locations/*/keyRings/*/cryptoKeys/*.latefinal -
deletionPolicy
↔ Output<
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.
latefinal
-
destination
↔ Output<
String> -
Destination is the message bus that the GoogleApiSource is delivering to.
It must be point to the full resource name of a MessageBus. Format:
"projects/{PROJECT_ID}/locations/{region}/messagesBuses/{MESSAGE_BUS_ID)
latefinal
-
displayName
↔ Output<
String?> -
Resource display name.
latefinal
-
effectiveAnnotations
↔ Output<
Map< String, String> > -
All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.
latefinal
-
effectiveLabels
↔ Output<
Map< String, String> > -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
-
etag
↔ Output<
String> -
This checksum is computed by the server based on the value of other
fields, and might be sent only on update and delete requests to ensure that
the client has an up-to-date value before proceeding.
latefinal
-
googleApiSourceId
↔ Output<
String> -
The user-provided ID to be assigned to the GoogleApiSource. It should match
the format
^a-z?$.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
labels
↔ Output<
Map< String, String> ?> -
Resource labels.
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field
effectiveLabelsfor all of the labels present on the resource.latefinal -
location
↔ Output<
String> -
Resource ID segment making up resource
name. It identifies the resource within its parent collection as described in https://google.aip.dev/122.latefinal -
loggingConfig
↔ Output<
GoogleApiSourceLoggingConfig> -
The configuration for Platform Telemetry logging for Eventarc Advanced
resources.
Structure is documented below.
latefinal
-
name
↔ Output<
String> -
Resource name of the form
projects/{project}/locations/{location}/googleApiSources/{google_api_source}
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
pulumiLabels
↔ Output<
Map< String, String> > -
The combination of labels configured directly on the resource
and default labels configured on the provider.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
uid
↔ Output<
String> -
Server assigned unique identifier for the channel. The value is a UUID4
string and guaranteed to remain unchanged until the resource is deleted.
latefinal
-
updateTime
↔ Output<
String> -
The last-modified time.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {GoogleApiSourceState? state, CustomResourceOptions? options}) → GoogleApiSource -
Gets an existing GoogleApiSource resource's state with the given
nameandid.