From d4dcce189ac2b9864591bbec417535ebb572170b Mon Sep 17 00:00:00 2001
From: Vijay Budhram
- Step 1: Create a pubsub queue. In order to do this click{' '}
-
- here
- {' '}
- to open a gcp terminal, and issue the following command:
-
- gcloud pubsub topics create rpQueue-{rpId}{' '}
- --message-retention-duration=2678400s
-
-
- Step 2: Next, update this{' '}
+ Step 1: Add the client id to the{' '}
+ eventbroker_endpoint_subscription_config map in{' '}
- file
+ {eventBrokerTfPath}
{' '}
- accordingly. This registers the webhook used for message delivery.
-
- Step 3: Next, update the OAUTH_CLIENT_IDS mappings{' '} - - here - - . This is used to map client-ids to a known name for legacy - amplitude events. This is considered optional, and may be RP - dependant. + (webservices-infra). One entry provisions the topic, the push + subscription, and the Firestore webhook document. +
{`"${rpId}" = {
+ endpoint = "",
+ resource_server = ,
+},`}
+ Both attributes are optional. resource_server defaults
+ to false. Omit endpoint entirely for a
+ topic with no webhook.
- Step 4: Provide the following secret in secure manner to the
+ Step 2: Provide the following secret in secure manner to the
relying party. This secret cannot be displayed again! If it is lost
or compromised, the RP's secret must be rotated.
diff --git a/packages/fxa-admin-panel/src/lib/utils.spec.ts b/packages/fxa-admin-panel/src/lib/utils.spec.ts
index 429fed44a77..83532c7c30d 100644
--- a/packages/fxa-admin-panel/src/lib/utils.spec.ts
+++ b/packages/fxa-admin-panel/src/lib/utils.spec.ts
@@ -2,7 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-import { getFormattedDuration } from './utils';
+import { getEventBrokerTfPath, getFormattedDuration } from './utils';
+
+const setHost = (host: string) => {
+ Object.defineProperty(window, 'location', {
+ value: { host },
+ writable: true,
+ });
+};
describe('utils', () => {
describe('formatDuration', () => {
@@ -24,4 +31,33 @@ describe('utils', () => {
);
});
});
+
+ describe('getEventBrokerTfPath', () => {
+ const originalLocation = window.location;
+
+ afterEach(() => {
+ Object.defineProperty(window, 'location', {
+ value: originalLocation,
+ writable: true,
+ });
+ });
+
+ it.each([
+ {
+ host: 'fxa-admin-panel.prod.mozaws.net',
+ expected: 'fxa-legacy/tf/prod/locals.tf',
+ },
+ {
+ host: 'fxa-admin-panel.prod.mozgcp.net',
+ expected: 'fxa-legacy/tf/prod/locals.tf',
+ },
+ {
+ host: 'fxa-admin-panel.stage.mozaws.net',
+ expected: 'fxa-legacy/tf/stage/locals.tf',
+ },
+ ])('should return $expected on $host', ({ host, expected }) => {
+ setHost(host);
+ expect(getEventBrokerTfPath()).toBe(expected);
+ });
+ });
});
diff --git a/packages/fxa-admin-panel/src/lib/utils.ts b/packages/fxa-admin-panel/src/lib/utils.ts
index 939221b3c16..d7a363d9c4f 100644
--- a/packages/fxa-admin-panel/src/lib/utils.ts
+++ b/packages/fxa-admin-panel/src/lib/utils.ts
@@ -22,3 +22,8 @@ export const getWafTfPath = () =>
window.location.host.startsWith('fxa-admin-panel.prod.')
? 'fxa/tf/prod/waf.tf'
: 'fxa/tf/stage/waf.tf';
+
+export const getEventBrokerTfPath = () =>
+ window.location.host.startsWith('fxa-admin-panel.prod.')
+ ? 'fxa-legacy/tf/prod/locals.tf'
+ : 'fxa-legacy/tf/stage/locals.tf';