From e244fdc862f1806cb7949e1d0d5c514a344501e7 Mon Sep 17 00:00:00 2001 From: Lisa Kim Date: Thu, 14 Nov 2024 05:26:30 -0800 Subject: [PATCH] Web: add a tooltip summary for aws oidc configure step (#46934) (#48954) --- .../Integrations/Enroll/AwsOidc/AwsOidc.tsx | 9 +- .../AwsOidc/ConfigureAwsOidcSummary.tsx | 87 +++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 web/packages/teleport/src/Integrations/Enroll/AwsOidc/ConfigureAwsOidcSummary.tsx diff --git a/web/packages/teleport/src/Integrations/Enroll/AwsOidc/AwsOidc.tsx b/web/packages/teleport/src/Integrations/Enroll/AwsOidc/AwsOidc.tsx index 26cbbd77acc18..f82f2ed0caccd 100644 --- a/web/packages/teleport/src/Integrations/Enroll/AwsOidc/AwsOidc.tsx +++ b/web/packages/teleport/src/Integrations/Enroll/AwsOidc/AwsOidc.tsx @@ -47,6 +47,7 @@ import { import cfg from 'teleport/config'; import { FinishDialog } from './FinishDialog'; +import { ConfigureAwsOidcSummary } from './ConfigureAwsOidcSummary'; export function AwsOidc() { const [integrationName, setIntegrationName] = useState(''); @@ -219,7 +220,13 @@ export function AwsOidc() { {scriptUrl && ( <> - Step 2 + + Step 2 + + Open{' '} . + */ + +import React from 'react'; +import styled from 'styled-components'; +import { Flex, Box, H3, Text } from 'design'; +import TextEditor from 'shared/components/TextEditor'; +import { ToolTipInfo } from 'shared/components/ToolTip'; + +import useStickyClusterId from 'teleport/useStickyClusterId'; + +export function ConfigureAwsOidcSummary({ + roleName, + integrationName, +}: { + roleName: string; + integrationName: string; +}) { + const { clusterId } = useStickyClusterId(); + + const json = `{ + "name": ${roleName}, + "description": "Used by Teleport to provide access to AWS resources.", + "trust_policy": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": "sts:AssumeRoleWithWebIdentity", + "Principal": { + "Federated": "":oidc-provider/${roleName}", + }, + "Condition": { + "StringEquals": { + "${clusterId}:aud": "discover.teleport", + } + } + } + ] + }, + "tags": { + "teleport.dev/cluster": "${clusterId}", + "teleport.dev/integration": "${integrationName}", + "teleport.dev/origin": "integration_awsoidc" + } +}`; + + return ( + +

Running the command in AWS CloudShell does the following:

+ 1. Configures an AWS IAM OIDC Identity Provider (IdP) + + 2. Configures an IAM role named "{roleName}" to trust the IdP: + + + + + + +
+ ); +} + +const EditorWrapper = styled(Flex)` + height: 300px; + margin-top: ${p => p.theme.space[3]}px; + width: 700px; +`;