Google Api Source Args
The Eventarc GoogleApiSource resource To get more information about GoogleApiSource, see:
How-to Guides
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 (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/eventarc"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/kms"
"github.com/pulumi/pulumi-gcp/sdk/v8/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(),
CryptoKeyName: pulumi.String(key.Id),
}, pulumi.DependsOn([]pulumi.Resource{
keyMember,
}))
if err != nil {
return err
}
return nil
})
}
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.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) {
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 thepulumi 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
Properties
Resource annotations. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field effective_annotations
for all of the annotations present on the resource.
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/*
.
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)
Resource display name.
The user-provided ID to be assigned to the GoogleApiSource. It should match the format ^a-z?$
.
The configuration for Platform Telemetry logging for Eventarc Advanced resources. Structure is documented below.