-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web: add a tooltip summary for aws oidc configure step (#46934)
- Loading branch information
Showing
2 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
web/packages/teleport/src/Integrations/Enroll/AwsOidc/ConfigureAwsOidcSummary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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": "<YOUR_ACCOUNT_ID>":oidc-provider/${roleName}", | ||
}, | ||
"Condition": { | ||
"StringEquals": { | ||
"${clusterId}:aud": "discover.teleport", | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"tags": { | ||
"teleport.dev/cluster": "${clusterId}", | ||
"teleport.dev/integration": "${integrationName}", | ||
"teleport.dev/origin": "integration_awsoidc" | ||
} | ||
}`; | ||
|
||
return ( | ||
<ToolTipInfo sticky={true} maxWidth={800}> | ||
<H3 mb={2}>Running the command in AWS CloudShell does the following:</H3> | ||
<Text>1. Configures an AWS IAM OIDC Identity Provider (IdP)</Text> | ||
<Text> | ||
2. Configures an IAM role named "{roleName}" to trust the IdP: | ||
</Text> | ||
<Box mb={2}> | ||
<EditorWrapper> | ||
<TextEditor | ||
readOnly={true} | ||
data={[{ content: json, type: 'json' }]} | ||
bg="levels.deep" | ||
/> | ||
</EditorWrapper> | ||
</Box> | ||
</ToolTipInfo> | ||
); | ||
} | ||
|
||
const EditorWrapper = styled(Flex)` | ||
height: 300px; | ||
margin-top: ${p => p.theme.space[3]}px; | ||
width: 700px; | ||
`; |