Skip to content

Commit 1837825

Browse files
committed
feat: policy for elasticsearch
1 parent 721f759 commit 1837825

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as aws from '@pulumi/aws'
2+
import * as pulumi from '@pulumi/pulumi'
3+
4+
export interface ESReadWritePolicyArgs {
5+
esArn: pulumi.Input<aws.ARN>
6+
}
7+
8+
export class ESReadWritePolicy extends pulumi.ComponentResource {
9+
readonly policy: aws.iam.Policy
10+
11+
constructor(name: string, args: ESReadWritePolicyArgs, opts?: pulumi.ComponentResourceOptions) {
12+
super('caya:ESReadWritePolicy', name, args, opts)
13+
const { esArn } = args
14+
const defaultParentOptions: pulumi.ResourceOptions = { parent: this }
15+
16+
this.policy = new aws.iam.Policy(
17+
name,
18+
{
19+
name,
20+
policy: {
21+
Version: '2012-10-17',
22+
Statement: [
23+
{
24+
Action: ['es:ESHttpHead', 'es:ESHttpGet', 'es:ESHttpPost', 'es:ESHttpPut', 'es:ESHttpDelete'],
25+
Effect: 'Allow',
26+
Resource: pulumi.output(esArn).apply(arn => `${arn}*`)
27+
}
28+
]
29+
}
30+
},
31+
defaultParentOptions
32+
)
33+
}
34+
}

src/components/policies/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './sns'
33
export * from './sqs'
44
export * from './textract'
55
export * from './s3'
6+
export * from './elasticsearch'

0 commit comments

Comments
 (0)