diff --git a/src/ConnectionConfig.tsx b/src/ConnectionConfig.tsx index 5381157..2c259eb 100644 --- a/src/ConnectionConfig.tsx +++ b/src/ConnectionConfig.tsx @@ -1,5 +1,5 @@ import React, { FC, useEffect, useMemo, useState } from 'react'; -import { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui'; +import { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet, Collapse } from '@grafana/ui'; import { DataSourcePluginOptionsEditorProps, onUpdateDatasourceJsonDataOptionSelect, @@ -29,16 +29,14 @@ export interface ConnectionConfigProps< children?: React.ReactNode; labelWidth?: number; inExperimentalAuthComponent?: boolean; + externalId?: string; } export const ConnectionConfig: FC = (props: ConnectionConfigProps) => { + const [isARNInstructionsOpen, setIsARNInstructionsOpen] = useState(false); const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption)); const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props; - const { - labelWidth = DEFAULT_LABEL_WIDTH, - options, - inExperimentalAuthComponent - } = props; + const { labelWidth = DEFAULT_LABEL_WIDTH, options, inExperimentalAuthComponent } = props; let profile = options.jsonData.profile; if (profile === undefined) { profile = options.database; @@ -76,7 +74,7 @@ export const ConnectionConfig: FC = (props: ConnectionCon loadRegions().then((regions) => setRegions(regions.map(toOption))); }, [loadRegions]); - const inputWidth = inExperimentalAuthComponent ? "width-20" : "width-30"; + const inputWidth = inExperimentalAuthComponent ? 'width-20' : 'width-30'; return (
@@ -159,6 +157,61 @@ export const ConnectionConfig: FC = (props: ConnectionCon )} + {options.jsonData.authType === AwsAuthType.GrafanaAssumeRole && ( + setIsARNInstructionsOpen(!isARNInstructionsOpen)} + > +
    +
  1. +

    + 1. Create a new IAM role in the AWS console, and select Another AWS account as the{' '} + Trusted entity. +

    +
  2. +
  3. +

    + 2. Enter the account ID of the Grafana account that has permission to assume this role: + 008923505280 and check the Require external ID box. +

    +
  4. +
  5. +

    + 3. Enter the following external ID:{' '} + {props.externalId || 'External Id is currently unavailable'} and click Next. +

    +
  6. +
  7. +

    + 4. Add any required permissions you would like Grafana to be able to access on your behalf. For more + details on our permissions please{' '} + + read through our documentation + + . +

    +
  8. +
  9. +

    + 5. Give the role a name and description, and click Create role. +

    +
  10. +
  11. +

    + 6. Copy the ARN of the role you just created and paste it into the Assume Role ARN field + below. +

    +
  12. +
+
+ )} + {awsAssumeRoleEnabled && ( <> = (props: ConnectionCon )} )} - {!skipEndpoint && ( + {!skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && (