Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions testing/aws-testing-cdk/lib/common/GitHubAccessStack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

import {Stack, StackProps} from 'aws-cdk-lib';
Expand All @@ -10,6 +14,7 @@ import {
CompositePrincipal,
OpenIdConnectPrincipal,
OpenIdConnectProvider,
PolicyStatement,
Role
} from 'aws-cdk-lib/aws-iam'

Expand Down Expand Up @@ -57,5 +62,10 @@ export class GitHubAccessStack extends Stack {
currentAccountPrincipal
)
});

this.gitHubActionsTestingRole.addToPolicy(new PolicyStatement({
actions: ['cloudformation:DescribeStacks'],
resources: [`arn:aws:cloudformation:*:${this.account}:stack/*`],
}));
}
}
11 changes: 10 additions & 1 deletion testing/aws-testing-cdk/lib/common/KmsStack.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

import {Stack, StackProps} from 'aws-cdk-lib';
import {CfnOutput, Stack, StackProps} from 'aws-cdk-lib';
import {Construct} from 'constructs';
import {Role} from 'aws-cdk-lib/aws-iam';
import {Key} from 'aws-cdk-lib/aws-kms';
Expand All @@ -27,6 +31,11 @@ export class KmsStack extends Stack {
});

this.kmsKey.grantEncryptDecrypt(props.testingRole)

new CfnOutput(this, 'KmsKeyId', {
value: this.kmsKey.keyArn,
exportName: 'DataPrepperAwsTesting-KmsKeyId',
});
}
}

15 changes: 12 additions & 3 deletions testing/aws-testing-cdk/lib/s3/S3SinkStack.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

import {Duration, RemovalPolicy, Stack, StackProps} from 'aws-cdk-lib';
import {CfnOutput, Duration, RemovalPolicy, Stack, StackProps} from 'aws-cdk-lib';
import {Construct} from 'constructs';
import {Role} from 'aws-cdk-lib/aws-iam';
import {Bucket} from 'aws-cdk-lib/aws-s3';
Expand All @@ -13,7 +17,7 @@ export interface S3SinkStackProps extends StackProps {
}

/**
* CDK stack that creates a common KMS key.
* CDK stack for resources needed by the S3 sink integration tests.
*/
export class S3SinkStack extends Stack {
readonly bucket: Bucket;
Expand All @@ -30,7 +34,12 @@ export class S3SinkStack extends Stack {
]
});

this.bucket.grantWrite(props.testingRole)
this.bucket.grantReadWrite(props.testingRole)

new CfnOutput(this, 'BucketName', {
value: this.bucket.bucketName,
exportName: 'DataPrepperAwsTesting-S3SinkBucketName',
});
}
}

Loading