aws-cdk-github-oidc 2.4.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/API.md CHANGED
@@ -1,18 +1,18 @@
1
- # API Reference <a name="API Reference"></a>
1
+ # API Reference <a name="API Reference" id="api-reference"></a>
2
2
 
3
- ## Constructs <a name="Constructs"></a>
3
+ ## Constructs <a name="Constructs" id="Constructs"></a>
4
4
 
5
- ### GithubActionsIdentityProvider <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider"></a>
5
+ ### GithubActionsIdentityProvider <a name="GithubActionsIdentityProvider" id="aws-cdk-github-oidc.GithubActionsIdentityProvider"></a>
6
6
 
7
- - *Implements:* [`aws-cdk-github-oidc.IGithubActionsIdentityProvider`](#aws-cdk-github-oidc.IGithubActionsIdentityProvider)
7
+ - *Implements:* <a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider">IGithubActionsIdentityProvider</a>
8
8
 
9
9
  Github Actions as OpenID Connect Identity Provider for AWS IAM. There can be only one (per AWS Account).
10
10
 
11
11
  Use `fromAccount` to retrieve a reference to existing Github OIDC provider.
12
12
 
13
- > https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
13
+ > [https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services)
14
14
 
15
- #### Initializers <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.Initializer"></a>
15
+ #### Initializers <a name="Initializers" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.Initializer"></a>
16
16
 
17
17
  ```typescript
18
18
  import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
@@ -20,105 +20,1085 @@ import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
20
20
  new GithubActionsIdentityProvider(scope: Construct, id: string)
21
21
  ```
22
22
 
23
- ##### `scope`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.parameter.scope"></a>
23
+ | **Name** | **Type** | **Description** |
24
+ | --- | --- | --- |
25
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | CDK Stack or Construct to which the provider is assigned to. |
26
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.Initializer.parameter.id">id</a></code> | <code>string</code> | CDK Construct ID given to the construct. |
24
27
 
25
- - *Type:* [`constructs.Construct`](#constructs.Construct)
28
+ ---
29
+
30
+ ##### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.Initializer.parameter.scope"></a>
31
+
32
+ - *Type:* constructs.Construct
33
+
34
+ CDK Stack or Construct to which the provider is assigned to.
35
+
36
+ ---
37
+
38
+ ##### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.Initializer.parameter.id"></a>
39
+
40
+ - *Type:* string
41
+
42
+ CDK Construct ID given to the construct.
43
+
44
+ ---
45
+
46
+ #### Methods <a name="Methods" id="Methods"></a>
47
+
48
+ | **Name** | **Description** |
49
+ | --- | --- |
50
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.toString">toString</a></code> | Returns a string representation of this construct. |
51
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
52
+
53
+ ---
54
+
55
+ ##### `toString` <a name="toString" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.toString"></a>
56
+
57
+ ```typescript
58
+ public toString(): string
59
+ ```
60
+
61
+ Returns a string representation of this construct.
62
+
63
+ ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.applyRemovalPolicy"></a>
64
+
65
+ ```typescript
66
+ public applyRemovalPolicy(policy: RemovalPolicy): void
67
+ ```
68
+
69
+ Apply the given removal policy to this resource.
70
+
71
+ The Removal Policy controls what happens to this resource when it stops
72
+ being managed by CloudFormation, either because you've removed it from the
73
+ CDK application or because you've made a change that requires the resource
74
+ to be replaced.
75
+
76
+ The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
77
+ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
78
+
79
+ ###### `policy`<sup>Required</sup> <a name="policy" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.applyRemovalPolicy.parameter.policy"></a>
80
+
81
+ - *Type:* aws-cdk-lib.RemovalPolicy
82
+
83
+ ---
84
+
85
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
86
+
87
+ | **Name** | **Description** |
88
+ | --- | --- |
89
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
90
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
91
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
92
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.fromOpenIdConnectProviderArn">fromOpenIdConnectProviderArn</a></code> | Imports an Open ID connect provider from an ARN. |
93
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.fromAccount">fromAccount</a></code> | Retrieve a reference to existing Github OIDC provider in your AWS account. |
94
+
95
+ ---
96
+
97
+ ##### `isConstruct` <a name="isConstruct" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.isConstruct"></a>
98
+
99
+ ```typescript
100
+ import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
101
+
102
+ GithubActionsIdentityProvider.isConstruct(x: any)
103
+ ```
104
+
105
+ Checks if `x` is a construct.
106
+
107
+ Use this method instead of `instanceof` to properly detect `Construct`
108
+ instances, even when the construct library is symlinked.
109
+
110
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
111
+ disk are seen as independent, completely different libraries. As a
112
+ consequence, the class `Construct` in each copy of the `constructs` library
113
+ is seen as a different class, and an instance of one class will not test as
114
+ `instanceof` the other class. `npm install` will not create installations
115
+ like this, but users may manually symlink construct libraries together or
116
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
117
+ library can be accidentally installed, and `instanceof` will behave
118
+ unpredictably. It is safest to avoid using `instanceof`, and using
119
+ this type-testing method instead.
120
+
121
+ ###### `x`<sup>Required</sup> <a name="x" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.isConstruct.parameter.x"></a>
122
+
123
+ - *Type:* any
124
+
125
+ Any object.
126
+
127
+ ---
128
+
129
+ ##### `isOwnedResource` <a name="isOwnedResource" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.isOwnedResource"></a>
130
+
131
+ ```typescript
132
+ import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
133
+
134
+ GithubActionsIdentityProvider.isOwnedResource(construct: IConstruct)
135
+ ```
136
+
137
+ Returns true if the construct was created by CDK, and false otherwise.
138
+
139
+ ###### `construct`<sup>Required</sup> <a name="construct" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.isOwnedResource.parameter.construct"></a>
140
+
141
+ - *Type:* constructs.IConstruct
142
+
143
+ ---
144
+
145
+ ##### `isResource` <a name="isResource" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.isResource"></a>
146
+
147
+ ```typescript
148
+ import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
149
+
150
+ GithubActionsIdentityProvider.isResource(construct: IConstruct)
151
+ ```
152
+
153
+ Check whether the given construct is a Resource.
154
+
155
+ ###### `construct`<sup>Required</sup> <a name="construct" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.isResource.parameter.construct"></a>
156
+
157
+ - *Type:* constructs.IConstruct
158
+
159
+ ---
160
+
161
+ ##### `fromOpenIdConnectProviderArn` <a name="fromOpenIdConnectProviderArn" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromOpenIdConnectProviderArn"></a>
162
+
163
+ ```typescript
164
+ import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
165
+
166
+ GithubActionsIdentityProvider.fromOpenIdConnectProviderArn(scope: Construct, id: string, openIdConnectProviderArn: string)
167
+ ```
168
+
169
+ Imports an Open ID connect provider from an ARN.
170
+
171
+ ###### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromOpenIdConnectProviderArn.parameter.scope"></a>
172
+
173
+ - *Type:* constructs.Construct
174
+
175
+ The definition scope.
176
+
177
+ ---
178
+
179
+ ###### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromOpenIdConnectProviderArn.parameter.id"></a>
180
+
181
+ - *Type:* string
182
+
183
+ ID of the construct.
184
+
185
+ ---
186
+
187
+ ###### `openIdConnectProviderArn`<sup>Required</sup> <a name="openIdConnectProviderArn" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromOpenIdConnectProviderArn.parameter.openIdConnectProviderArn"></a>
188
+
189
+ - *Type:* string
190
+
191
+ the ARN to import.
192
+
193
+ ---
194
+
195
+ ##### `fromAccount` <a name="fromAccount" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromAccount"></a>
196
+
197
+ ```typescript
198
+ import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
199
+
200
+ GithubActionsIdentityProvider.fromAccount(scope: Construct, id: string)
201
+ ```
202
+
203
+ Retrieve a reference to existing Github OIDC provider in your AWS account.
204
+
205
+ An AWS account can only have single Github OIDC provider configured into it,
206
+ so internally the reference is made by constructing the ARN from AWS
207
+ Account ID & Github issuer URL.
208
+
209
+ *Example*
210
+
211
+ ```typescript
212
+ GithubActionsIdentityProvider.fromAccount(scope, "GithubProvider");
213
+ ```
214
+
215
+
216
+ ###### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromAccount.parameter.scope"></a>
217
+
218
+ - *Type:* constructs.Construct
219
+
220
+ CDK Stack or Construct to which the provider is assigned to.
221
+
222
+ ---
223
+
224
+ ###### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromAccount.parameter.id"></a>
225
+
226
+ - *Type:* string
227
+
228
+ CDK Construct ID given to the construct.
229
+
230
+ ---
231
+
232
+ #### Properties <a name="Properties" id="Properties"></a>
233
+
234
+ | **Name** | **Type** | **Description** |
235
+ | --- | --- | --- |
236
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
237
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. |
238
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
239
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.oidcProviderRef">oidcProviderRef</a></code> | <code>aws-cdk-lib.aws_iam.OIDCProviderReference</code> | A reference to a OIDCProvider resource. |
240
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.openIdConnectProviderArn">openIdConnectProviderArn</a></code> | <code>string</code> | The Amazon Resource Name (ARN) of the IAM OpenID Connect provider. |
241
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.openIdConnectProviderIssuer">openIdConnectProviderIssuer</a></code> | <code>string</code> | The issuer for OIDC Provider. |
242
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.openIdConnectProviderthumbprints">openIdConnectProviderthumbprints</a></code> | <code>string</code> | The thumbprints configured for this provider. |
243
+
244
+ ---
245
+
246
+ ##### `node`<sup>Required</sup> <a name="node" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.node"></a>
247
+
248
+ ```typescript
249
+ public readonly node: Node;
250
+ ```
251
+
252
+ - *Type:* constructs.Node
253
+
254
+ The tree node.
255
+
256
+ ---
257
+
258
+ ##### `env`<sup>Required</sup> <a name="env" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.env"></a>
259
+
260
+ ```typescript
261
+ public readonly env: ResourceEnvironment;
262
+ ```
263
+
264
+ - *Type:* aws-cdk-lib.ResourceEnvironment
265
+
266
+ The environment this resource belongs to.
267
+
268
+ For resources that are created and managed by the CDK
269
+ (generally, those created by creating new class instances like Role, Bucket, etc.),
270
+ this is always the same as the environment of the stack they belong to;
271
+ however, for imported resources
272
+ (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
273
+ that might be different than the stack they were imported into.
274
+
275
+ ---
276
+
277
+ ##### `stack`<sup>Required</sup> <a name="stack" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.stack"></a>
278
+
279
+ ```typescript
280
+ public readonly stack: Stack;
281
+ ```
282
+
283
+ - *Type:* aws-cdk-lib.Stack
284
+
285
+ The stack in which this resource is defined.
286
+
287
+ ---
288
+
289
+ ##### `oidcProviderRef`<sup>Required</sup> <a name="oidcProviderRef" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.oidcProviderRef"></a>
290
+
291
+ ```typescript
292
+ public readonly oidcProviderRef: OIDCProviderReference;
293
+ ```
294
+
295
+ - *Type:* aws-cdk-lib.aws_iam.OIDCProviderReference
296
+
297
+ A reference to a OIDCProvider resource.
298
+
299
+ ---
300
+
301
+ ##### `openIdConnectProviderArn`<sup>Required</sup> <a name="openIdConnectProviderArn" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.openIdConnectProviderArn"></a>
302
+
303
+ ```typescript
304
+ public readonly openIdConnectProviderArn: string;
305
+ ```
306
+
307
+ - *Type:* string
308
+
309
+ The Amazon Resource Name (ARN) of the IAM OpenID Connect provider.
310
+
311
+ ---
312
+
313
+ ##### `openIdConnectProviderIssuer`<sup>Required</sup> <a name="openIdConnectProviderIssuer" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.openIdConnectProviderIssuer"></a>
314
+
315
+ ```typescript
316
+ public readonly openIdConnectProviderIssuer: string;
317
+ ```
318
+
319
+ - *Type:* string
320
+
321
+ The issuer for OIDC Provider.
322
+
323
+ ---
324
+
325
+ ##### `openIdConnectProviderthumbprints`<sup>Required</sup> <a name="openIdConnectProviderthumbprints" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.openIdConnectProviderthumbprints"></a>
326
+
327
+ ```typescript
328
+ public readonly openIdConnectProviderthumbprints: string;
329
+ ```
330
+
331
+ - *Type:* string
332
+
333
+ The thumbprints configured for this provider.
334
+
335
+ ---
336
+
337
+ #### Constants <a name="Constants" id="Constants"></a>
338
+
339
+ | **Name** | **Type** | **Description** |
340
+ | --- | --- | --- |
341
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.PROPERTY_INJECTION_ID">PROPERTY_INJECTION_ID</a></code> | <code>string</code> | Uniquely identifies this class. |
342
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider.property.issuer">issuer</a></code> | <code>string</code> | *No description.* |
343
+
344
+ ---
345
+
346
+ ##### `PROPERTY_INJECTION_ID`<sup>Required</sup> <a name="PROPERTY_INJECTION_ID" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.PROPERTY_INJECTION_ID"></a>
347
+
348
+ ```typescript
349
+ public readonly PROPERTY_INJECTION_ID: string;
350
+ ```
351
+
352
+ - *Type:* string
353
+
354
+ Uniquely identifies this class.
355
+
356
+ ---
357
+
358
+ ##### `issuer`<sup>Required</sup> <a name="issuer" id="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.issuer"></a>
359
+
360
+ ```typescript
361
+ public readonly issuer: string;
362
+ ```
363
+
364
+ - *Type:* string
365
+
366
+ ---
367
+
368
+ ### GithubActionsRole <a name="GithubActionsRole" id="aws-cdk-github-oidc.GithubActionsRole"></a>
369
+
370
+ Define an IAM Role that can be assumed by Github Actions workflow via Github OpenID Connect Identity Provider.
371
+
372
+ Besides `GithubConfiguration`, you may pass in any `iam.RoleProps` except `assumedBy`
373
+ which will be defined by this construct (CDK will fail if you do).
374
+
375
+ *Example*
376
+
377
+ ```typescript
378
+ const uploadRole = new GithubActionsRole(scope, "UploadRole", {
379
+ provider: GithubActionsIdentityProvider.fromAccount(scope, "GithubProvider"),
380
+ owner: 'octo-org',
381
+ repo: 'octo-repo',
382
+ filter: 'ref:refs/tags/v*',
383
+ roleName: 'MyUploadRole',
384
+ });
385
+
386
+ myBucket.grantWrite(uploadRole);
387
+ ```
388
+
389
+
390
+ #### Initializers <a name="Initializers" id="aws-cdk-github-oidc.GithubActionsRole.Initializer"></a>
391
+
392
+ ```typescript
393
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
394
+
395
+ new GithubActionsRole(scope: Construct, id: string, props: GithubActionsRoleProps)
396
+ ```
397
+
398
+ | **Name** | **Type** | **Description** |
399
+ | --- | --- | --- |
400
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
401
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
402
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.Initializer.parameter.props">props</a></code> | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps">GithubActionsRoleProps</a></code> | *No description.* |
403
+
404
+ ---
405
+
406
+ ##### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsRole.Initializer.parameter.scope"></a>
407
+
408
+ - *Type:* constructs.Construct
409
+
410
+ ---
411
+
412
+ ##### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsRole.Initializer.parameter.id"></a>
413
+
414
+ - *Type:* string
415
+
416
+ ---
417
+
418
+ ##### `props`<sup>Required</sup> <a name="props" id="aws-cdk-github-oidc.GithubActionsRole.Initializer.parameter.props"></a>
419
+
420
+ - *Type:* <a href="#aws-cdk-github-oidc.GithubActionsRoleProps">GithubActionsRoleProps</a>
421
+
422
+ ---
423
+
424
+ #### Methods <a name="Methods" id="Methods"></a>
425
+
426
+ | **Name** | **Description** |
427
+ | --- | --- |
428
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.toString">toString</a></code> | Returns a string representation of this construct. |
429
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.applyRemovalPolicy">applyRemovalPolicy</a></code> | Skip applyRemovalPolicy if role synthesis is prevented by customizeRoles. |
430
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.addManagedPolicy">addManagedPolicy</a></code> | Attaches a managed policy to this role. |
431
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.addToPolicy">addToPolicy</a></code> | Add to the policy of this principal. |
432
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.addToPrincipalPolicy">addToPrincipalPolicy</a></code> | Adds a permission to the role's default policy document. |
433
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.attachInlinePolicy">attachInlinePolicy</a></code> | Attaches a policy to this role. |
434
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.grant">grant</a></code> | Grant the actions defined in actions to the identity Principal on this resource. |
435
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.grantAssumeRole">grantAssumeRole</a></code> | Grant permissions to the given principal to assume this role. |
436
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.grantPassRole">grantPassRole</a></code> | Grant permissions to the given principal to pass this role. |
437
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.withoutPolicyUpdates">withoutPolicyUpdates</a></code> | Return a copy of this Role object whose Policies will not be updated. |
438
+
439
+ ---
440
+
441
+ ##### `toString` <a name="toString" id="aws-cdk-github-oidc.GithubActionsRole.toString"></a>
442
+
443
+ ```typescript
444
+ public toString(): string
445
+ ```
446
+
447
+ Returns a string representation of this construct.
448
+
449
+ ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="aws-cdk-github-oidc.GithubActionsRole.applyRemovalPolicy"></a>
450
+
451
+ ```typescript
452
+ public applyRemovalPolicy(policy: RemovalPolicy): void
453
+ ```
454
+
455
+ Skip applyRemovalPolicy if role synthesis is prevented by customizeRoles.
456
+
457
+ Because in this case, this construct does not have a CfnResource in the tree.
458
+
459
+ ###### `policy`<sup>Required</sup> <a name="policy" id="aws-cdk-github-oidc.GithubActionsRole.applyRemovalPolicy.parameter.policy"></a>
460
+
461
+ - *Type:* aws-cdk-lib.RemovalPolicy
462
+
463
+ RemovalPolicy.
464
+
465
+ ---
466
+
467
+ ##### `addManagedPolicy` <a name="addManagedPolicy" id="aws-cdk-github-oidc.GithubActionsRole.addManagedPolicy"></a>
468
+
469
+ ```typescript
470
+ public addManagedPolicy(policy: IManagedPolicy): void
471
+ ```
472
+
473
+ Attaches a managed policy to this role.
474
+
475
+ ###### `policy`<sup>Required</sup> <a name="policy" id="aws-cdk-github-oidc.GithubActionsRole.addManagedPolicy.parameter.policy"></a>
476
+
477
+ - *Type:* aws-cdk-lib.aws_iam.IManagedPolicy
478
+
479
+ The the managed policy to attach.
480
+
481
+ ---
482
+
483
+ ##### `addToPolicy` <a name="addToPolicy" id="aws-cdk-github-oidc.GithubActionsRole.addToPolicy"></a>
484
+
485
+ ```typescript
486
+ public addToPolicy(statement: PolicyStatement): boolean
487
+ ```
488
+
489
+ Add to the policy of this principal.
490
+
491
+ ###### `statement`<sup>Required</sup> <a name="statement" id="aws-cdk-github-oidc.GithubActionsRole.addToPolicy.parameter.statement"></a>
492
+
493
+ - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
494
+
495
+ ---
496
+
497
+ ##### `addToPrincipalPolicy` <a name="addToPrincipalPolicy" id="aws-cdk-github-oidc.GithubActionsRole.addToPrincipalPolicy"></a>
498
+
499
+ ```typescript
500
+ public addToPrincipalPolicy(statement: PolicyStatement): AddToPrincipalPolicyResult
501
+ ```
502
+
503
+ Adds a permission to the role's default policy document.
504
+
505
+ If there is no default policy attached to this role, it will be created.
506
+
507
+ ###### `statement`<sup>Required</sup> <a name="statement" id="aws-cdk-github-oidc.GithubActionsRole.addToPrincipalPolicy.parameter.statement"></a>
508
+
509
+ - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
510
+
511
+ The permission statement to add to the policy document.
512
+
513
+ ---
514
+
515
+ ##### `attachInlinePolicy` <a name="attachInlinePolicy" id="aws-cdk-github-oidc.GithubActionsRole.attachInlinePolicy"></a>
516
+
517
+ ```typescript
518
+ public attachInlinePolicy(policy: Policy): void
519
+ ```
520
+
521
+ Attaches a policy to this role.
522
+
523
+ ###### `policy`<sup>Required</sup> <a name="policy" id="aws-cdk-github-oidc.GithubActionsRole.attachInlinePolicy.parameter.policy"></a>
524
+
525
+ - *Type:* aws-cdk-lib.aws_iam.Policy
526
+
527
+ The policy to attach.
528
+
529
+ ---
530
+
531
+ ##### `grant` <a name="grant" id="aws-cdk-github-oidc.GithubActionsRole.grant"></a>
532
+
533
+ ```typescript
534
+ public grant(grantee: IPrincipal, actions: ...string[]): Grant
535
+ ```
536
+
537
+ Grant the actions defined in actions to the identity Principal on this resource.
538
+
539
+ ###### `grantee`<sup>Required</sup> <a name="grantee" id="aws-cdk-github-oidc.GithubActionsRole.grant.parameter.grantee"></a>
540
+
541
+ - *Type:* aws-cdk-lib.aws_iam.IPrincipal
542
+
543
+ ---
544
+
545
+ ###### `actions`<sup>Required</sup> <a name="actions" id="aws-cdk-github-oidc.GithubActionsRole.grant.parameter.actions"></a>
546
+
547
+ - *Type:* ...string[]
548
+
549
+ ---
550
+
551
+ ##### `grantAssumeRole` <a name="grantAssumeRole" id="aws-cdk-github-oidc.GithubActionsRole.grantAssumeRole"></a>
552
+
553
+ ```typescript
554
+ public grantAssumeRole(identity: IPrincipal): Grant
555
+ ```
556
+
557
+ Grant permissions to the given principal to assume this role.
558
+
559
+ ###### `identity`<sup>Required</sup> <a name="identity" id="aws-cdk-github-oidc.GithubActionsRole.grantAssumeRole.parameter.identity"></a>
560
+
561
+ - *Type:* aws-cdk-lib.aws_iam.IPrincipal
562
+
563
+ ---
564
+
565
+ ##### `grantPassRole` <a name="grantPassRole" id="aws-cdk-github-oidc.GithubActionsRole.grantPassRole"></a>
566
+
567
+ ```typescript
568
+ public grantPassRole(identity: IPrincipal): Grant
569
+ ```
570
+
571
+ Grant permissions to the given principal to pass this role.
572
+
573
+ ###### `identity`<sup>Required</sup> <a name="identity" id="aws-cdk-github-oidc.GithubActionsRole.grantPassRole.parameter.identity"></a>
574
+
575
+ - *Type:* aws-cdk-lib.aws_iam.IPrincipal
576
+
577
+ ---
578
+
579
+ ##### `withoutPolicyUpdates` <a name="withoutPolicyUpdates" id="aws-cdk-github-oidc.GithubActionsRole.withoutPolicyUpdates"></a>
580
+
581
+ ```typescript
582
+ public withoutPolicyUpdates(options?: WithoutPolicyUpdatesOptions): IRole
583
+ ```
584
+
585
+ Return a copy of this Role object whose Policies will not be updated.
586
+
587
+ Use the object returned by this method if you want this Role to be used by
588
+ a construct without it automatically updating the Role's Policies.
589
+
590
+ If you do, you are responsible for adding the correct statements to the
591
+ Role's policies yourself.
592
+
593
+ ###### `options`<sup>Optional</sup> <a name="options" id="aws-cdk-github-oidc.GithubActionsRole.withoutPolicyUpdates.parameter.options"></a>
594
+
595
+ - *Type:* aws-cdk-lib.aws_iam.WithoutPolicyUpdatesOptions
596
+
597
+ ---
598
+
599
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
600
+
601
+ | **Name** | **Description** |
602
+ | --- | --- |
603
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
604
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
605
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
606
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.customizeRoles">customizeRoles</a></code> | Customize the creation of IAM roles within the given scope. |
607
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.fromLookup">fromLookup</a></code> | Lookup an existing Role. |
608
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.fromRoleArn">fromRoleArn</a></code> | Import an external role by ARN. |
609
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.fromRoleName">fromRoleName</a></code> | Import an external role by name. |
610
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.isRole">isRole</a></code> | Return whether the given object is a Role. |
611
+
612
+ ---
613
+
614
+ ##### `isConstruct` <a name="isConstruct" id="aws-cdk-github-oidc.GithubActionsRole.isConstruct"></a>
615
+
616
+ ```typescript
617
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
618
+
619
+ GithubActionsRole.isConstruct(x: any)
620
+ ```
621
+
622
+ Checks if `x` is a construct.
623
+
624
+ Use this method instead of `instanceof` to properly detect `Construct`
625
+ instances, even when the construct library is symlinked.
626
+
627
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
628
+ disk are seen as independent, completely different libraries. As a
629
+ consequence, the class `Construct` in each copy of the `constructs` library
630
+ is seen as a different class, and an instance of one class will not test as
631
+ `instanceof` the other class. `npm install` will not create installations
632
+ like this, but users may manually symlink construct libraries together or
633
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
634
+ library can be accidentally installed, and `instanceof` will behave
635
+ unpredictably. It is safest to avoid using `instanceof`, and using
636
+ this type-testing method instead.
637
+
638
+ ###### `x`<sup>Required</sup> <a name="x" id="aws-cdk-github-oidc.GithubActionsRole.isConstruct.parameter.x"></a>
639
+
640
+ - *Type:* any
641
+
642
+ Any object.
643
+
644
+ ---
645
+
646
+ ##### `isOwnedResource` <a name="isOwnedResource" id="aws-cdk-github-oidc.GithubActionsRole.isOwnedResource"></a>
647
+
648
+ ```typescript
649
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
650
+
651
+ GithubActionsRole.isOwnedResource(construct: IConstruct)
652
+ ```
653
+
654
+ Returns true if the construct was created by CDK, and false otherwise.
655
+
656
+ ###### `construct`<sup>Required</sup> <a name="construct" id="aws-cdk-github-oidc.GithubActionsRole.isOwnedResource.parameter.construct"></a>
657
+
658
+ - *Type:* constructs.IConstruct
659
+
660
+ ---
661
+
662
+ ##### `isResource` <a name="isResource" id="aws-cdk-github-oidc.GithubActionsRole.isResource"></a>
663
+
664
+ ```typescript
665
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
666
+
667
+ GithubActionsRole.isResource(construct: IConstruct)
668
+ ```
669
+
670
+ Check whether the given construct is a Resource.
671
+
672
+ ###### `construct`<sup>Required</sup> <a name="construct" id="aws-cdk-github-oidc.GithubActionsRole.isResource.parameter.construct"></a>
673
+
674
+ - *Type:* constructs.IConstruct
675
+
676
+ ---
677
+
678
+ ##### `customizeRoles` <a name="customizeRoles" id="aws-cdk-github-oidc.GithubActionsRole.customizeRoles"></a>
679
+
680
+ ```typescript
681
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
26
682
 
27
- CDK Stack or Construct to which the provider is assigned to.
683
+ GithubActionsRole.customizeRoles(scope: Construct, options?: CustomizeRolesOptions)
684
+ ```
685
+
686
+ Customize the creation of IAM roles within the given scope.
687
+
688
+ It is recommended that you **do not** use this method and instead allow
689
+ CDK to manage role creation. This should only be used
690
+ in environments where CDK applications are not allowed to created IAM roles.
691
+
692
+ This can be used to prevent the CDK application from creating roles
693
+ within the given scope and instead replace the references to the roles with
694
+ precreated role names. A report will be synthesized in the cloud assembly (i.e. cdk.out)
695
+ that will contain the list of IAM roles that would have been created along with the
696
+ IAM policy statements that the role should contain. This report can then be used
697
+ to create the IAM roles outside of CDK and then the created role names can be provided
698
+ in `usePrecreatedRoles`.
699
+
700
+ *Example*
701
+
702
+ ```typescript
703
+ declare const app: App;
704
+ iam.Role.customizeRoles(app, {
705
+ usePrecreatedRoles: {
706
+ 'ConstructPath/To/Role': 'my-precreated-role-name',
707
+ },
708
+ });
709
+ ```
710
+
711
+
712
+ ###### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsRole.customizeRoles.parameter.scope"></a>
713
+
714
+ - *Type:* constructs.Construct
715
+
716
+ construct scope to customize role creation.
28
717
 
29
718
  ---
30
719
 
31
- ##### `id`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.parameter.id"></a>
720
+ ###### `options`<sup>Optional</sup> <a name="options" id="aws-cdk-github-oidc.GithubActionsRole.customizeRoles.parameter.options"></a>
32
721
 
33
- - *Type:* `string`
722
+ - *Type:* aws-cdk-lib.aws_iam.CustomizeRolesOptions
34
723
 
35
- CDK Construct ID given to the construct.
724
+ options for configuring role creation.
725
+
726
+ ---
727
+
728
+ ##### `fromLookup` <a name="fromLookup" id="aws-cdk-github-oidc.GithubActionsRole.fromLookup"></a>
729
+
730
+ ```typescript
731
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
732
+
733
+ GithubActionsRole.fromLookup(scope: Construct, id: string, options: RoleLookupOptions)
734
+ ```
735
+
736
+ Lookup an existing Role.
737
+
738
+ ###### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsRole.fromLookup.parameter.scope"></a>
739
+
740
+ - *Type:* constructs.Construct
741
+
742
+ ---
743
+
744
+ ###### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsRole.fromLookup.parameter.id"></a>
745
+
746
+ - *Type:* string
36
747
 
37
748
  ---
38
749
 
750
+ ###### `options`<sup>Required</sup> <a name="options" id="aws-cdk-github-oidc.GithubActionsRole.fromLookup.parameter.options"></a>
751
+
752
+ - *Type:* aws-cdk-lib.aws_iam.RoleLookupOptions
39
753
 
40
- #### Static Functions <a name="Static Functions"></a>
754
+ ---
41
755
 
42
- ##### `fromAccount` <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.fromAccount"></a>
756
+ ##### `fromRoleArn` <a name="fromRoleArn" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleArn"></a>
43
757
 
44
758
  ```typescript
45
- import { GithubActionsIdentityProvider } from 'aws-cdk-github-oidc'
759
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
46
760
 
47
- GithubActionsIdentityProvider.fromAccount(scope: Construct, id: string)
761
+ GithubActionsRole.fromRoleArn(scope: Construct, id: string, roleArn: string, options?: FromRoleArnOptions)
48
762
  ```
49
763
 
50
- ###### `scope`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.parameter.scope"></a>
764
+ Import an external role by ARN.
51
765
 
52
- - *Type:* [`constructs.Construct`](#constructs.Construct)
766
+ If the imported Role ARN is a Token (such as a
767
+ `CfnParameter.valueAsString` or a `Fn.importValue()`) *and* the referenced
768
+ role has a `path` (like `arn:...:role/AdminRoles/Alice`), the
769
+ `roleName` property will not resolve to the correct value. Instead it
770
+ will resolve to the first path component. We unfortunately cannot express
771
+ the correct calculation of the full path name as a CloudFormation
772
+ expression. In this scenario the Role ARN should be supplied without the
773
+ `path` in order to resolve the correct role resource.
53
774
 
54
- CDK Stack or Construct to which the provider is assigned to.
775
+ ###### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleArn.parameter.scope"></a>
776
+
777
+ - *Type:* constructs.Construct
778
+
779
+ construct scope.
55
780
 
56
781
  ---
57
782
 
58
- ###### `id`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.parameter.id"></a>
783
+ ###### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleArn.parameter.id"></a>
59
784
 
60
- - *Type:* `string`
785
+ - *Type:* string
61
786
 
62
- CDK Construct ID given to the construct.
787
+ construct id.
63
788
 
64
789
  ---
65
790
 
791
+ ###### `roleArn`<sup>Required</sup> <a name="roleArn" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleArn.parameter.roleArn"></a>
792
+
793
+ - *Type:* string
794
+
795
+ the ARN of the role to import.
66
796
 
67
- #### Constants <a name="Constants"></a>
797
+ ---
798
+
799
+ ###### `options`<sup>Optional</sup> <a name="options" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleArn.parameter.options"></a>
68
800
 
69
- ##### `issuer` <a name="aws-cdk-github-oidc.GithubActionsIdentityProvider.property.issuer"></a>
801
+ - *Type:* aws-cdk-lib.aws_iam.FromRoleArnOptions
70
802
 
71
- - *Type:* `string`
803
+ allow customizing the behavior of the returned role.
72
804
 
73
805
  ---
74
806
 
75
- ### GithubActionsRole <a name="aws-cdk-github-oidc.GithubActionsRole"></a>
807
+ ##### `fromRoleName` <a name="fromRoleName" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleName"></a>
76
808
 
77
- Define an IAM Role that can be assumed by Github Actions workflow via Github OpenID Connect Identity Provider.
809
+ ```typescript
810
+ import { GithubActionsRole } from 'aws-cdk-github-oidc'
78
811
 
79
- Besides `GithubConfiguration`, you may pass in any `iam.RoleProps` except `assumedBy`
80
- which will be defined by this construct (CDK will fail if you do).
812
+ GithubActionsRole.fromRoleName(scope: Construct, id: string, roleName: string, options?: FromRoleNameOptions)
813
+ ```
814
+
815
+ Import an external role by name.
816
+
817
+ The imported role is assumed to exist in the same account as the account
818
+ the scope's containing Stack is being deployed to.
819
+
820
+ ###### `scope`<sup>Required</sup> <a name="scope" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleName.parameter.scope"></a>
821
+
822
+ - *Type:* constructs.Construct
823
+
824
+ construct scope.
825
+
826
+ ---
827
+
828
+ ###### `id`<sup>Required</sup> <a name="id" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleName.parameter.id"></a>
829
+
830
+ - *Type:* string
831
+
832
+ construct id.
833
+
834
+ ---
835
+
836
+ ###### `roleName`<sup>Required</sup> <a name="roleName" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleName.parameter.roleName"></a>
837
+
838
+ - *Type:* string
839
+
840
+ the name of the role to import.
841
+
842
+ ---
843
+
844
+ ###### `options`<sup>Optional</sup> <a name="options" id="aws-cdk-github-oidc.GithubActionsRole.fromRoleName.parameter.options"></a>
845
+
846
+ - *Type:* aws-cdk-lib.aws_iam.FromRoleNameOptions
847
+
848
+ allow customizing the behavior of the returned role.
81
849
 
82
- #### Initializers <a name="aws-cdk-github-oidc.GithubActionsRole.Initializer"></a>
850
+ ---
851
+
852
+ ##### `isRole` <a name="isRole" id="aws-cdk-github-oidc.GithubActionsRole.isRole"></a>
83
853
 
84
854
  ```typescript
85
855
  import { GithubActionsRole } from 'aws-cdk-github-oidc'
86
856
 
87
- new GithubActionsRole(scope: Construct, id: string, props: GithubActionsRoleProps)
857
+ GithubActionsRole.isRole(x: any)
858
+ ```
859
+
860
+ Return whether the given object is a Role.
861
+
862
+ ###### `x`<sup>Required</sup> <a name="x" id="aws-cdk-github-oidc.GithubActionsRole.isRole.parameter.x"></a>
863
+
864
+ - *Type:* any
865
+
866
+ ---
867
+
868
+ #### Properties <a name="Properties" id="Properties"></a>
869
+
870
+ | **Name** | **Type** | **Description** |
871
+ | --- | --- | --- |
872
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
873
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. |
874
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
875
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.assumeRoleAction">assumeRoleAction</a></code> | <code>string</code> | When this Principal is used in an AssumeRole policy, the action to use. |
876
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to. |
877
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.policyFragment">policyFragment</a></code> | <code>aws-cdk-lib.aws_iam.PrincipalPolicyFragment</code> | Returns the role. |
878
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.roleArn">roleArn</a></code> | <code>string</code> | Returns the ARN of this role. |
879
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.roleId">roleId</a></code> | <code>string</code> | Returns the stable and unique string identifying the role. |
880
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.roleName">roleName</a></code> | <code>string</code> | Returns the name of the role. |
881
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.roleRef">roleRef</a></code> | <code>aws-cdk-lib.aws_iam.RoleReference</code> | A reference to a Role resource. |
882
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.assumeRolePolicy">assumeRolePolicy</a></code> | <code>aws-cdk-lib.aws_iam.PolicyDocument</code> | The assume role policy document associated with this role. |
883
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.permissionsBoundary">permissionsBoundary</a></code> | <code>aws-cdk-lib.aws_iam.IManagedPolicy</code> | Returns the permissions boundary attached to this role. |
884
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.principalAccount">principalAccount</a></code> | <code>string</code> | The AWS account ID of this principal. |
885
+
886
+ ---
887
+
888
+ ##### `node`<sup>Required</sup> <a name="node" id="aws-cdk-github-oidc.GithubActionsRole.property.node"></a>
889
+
890
+ ```typescript
891
+ public readonly node: Node;
892
+ ```
893
+
894
+ - *Type:* constructs.Node
895
+
896
+ The tree node.
897
+
898
+ ---
899
+
900
+ ##### `env`<sup>Required</sup> <a name="env" id="aws-cdk-github-oidc.GithubActionsRole.property.env"></a>
901
+
902
+ ```typescript
903
+ public readonly env: ResourceEnvironment;
904
+ ```
905
+
906
+ - *Type:* aws-cdk-lib.ResourceEnvironment
907
+
908
+ The environment this resource belongs to.
909
+
910
+ For resources that are created and managed by the CDK
911
+ (generally, those created by creating new class instances like Role, Bucket, etc.),
912
+ this is always the same as the environment of the stack they belong to;
913
+ however, for imported resources
914
+ (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
915
+ that might be different than the stack they were imported into.
916
+
917
+ ---
918
+
919
+ ##### `stack`<sup>Required</sup> <a name="stack" id="aws-cdk-github-oidc.GithubActionsRole.property.stack"></a>
920
+
921
+ ```typescript
922
+ public readonly stack: Stack;
923
+ ```
924
+
925
+ - *Type:* aws-cdk-lib.Stack
926
+
927
+ The stack in which this resource is defined.
928
+
929
+ ---
930
+
931
+ ##### `assumeRoleAction`<sup>Required</sup> <a name="assumeRoleAction" id="aws-cdk-github-oidc.GithubActionsRole.property.assumeRoleAction"></a>
932
+
933
+ ```typescript
934
+ public readonly assumeRoleAction: string;
935
+ ```
936
+
937
+ - *Type:* string
938
+
939
+ When this Principal is used in an AssumeRole policy, the action to use.
940
+
941
+ ---
942
+
943
+ ##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="aws-cdk-github-oidc.GithubActionsRole.property.grantPrincipal"></a>
944
+
945
+ ```typescript
946
+ public readonly grantPrincipal: IPrincipal;
88
947
  ```
89
948
 
90
- ##### `scope`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsRole.parameter.scope"></a>
949
+ - *Type:* aws-cdk-lib.aws_iam.IPrincipal
91
950
 
92
- - *Type:* [`constructs.Construct`](#constructs.Construct)
951
+ The principal to grant permissions to.
93
952
 
94
953
  ---
95
954
 
96
- ##### `id`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsRole.parameter.id"></a>
955
+ ##### `policyFragment`<sup>Required</sup> <a name="policyFragment" id="aws-cdk-github-oidc.GithubActionsRole.property.policyFragment"></a>
97
956
 
98
- - *Type:* `string`
957
+ ```typescript
958
+ public readonly policyFragment: PrincipalPolicyFragment;
959
+ ```
960
+
961
+ - *Type:* aws-cdk-lib.aws_iam.PrincipalPolicyFragment
962
+
963
+ Returns the role.
964
+
965
+ ---
966
+
967
+ ##### `roleArn`<sup>Required</sup> <a name="roleArn" id="aws-cdk-github-oidc.GithubActionsRole.property.roleArn"></a>
968
+
969
+ ```typescript
970
+ public readonly roleArn: string;
971
+ ```
972
+
973
+ - *Type:* string
974
+
975
+ Returns the ARN of this role.
976
+
977
+ ---
978
+
979
+ ##### `roleId`<sup>Required</sup> <a name="roleId" id="aws-cdk-github-oidc.GithubActionsRole.property.roleId"></a>
980
+
981
+ ```typescript
982
+ public readonly roleId: string;
983
+ ```
984
+
985
+ - *Type:* string
986
+
987
+ Returns the stable and unique string identifying the role.
988
+
989
+ For example,
990
+ AIDAJQABLZS4A3QDU576Q.
991
+
992
+ ---
993
+
994
+ ##### `roleName`<sup>Required</sup> <a name="roleName" id="aws-cdk-github-oidc.GithubActionsRole.property.roleName"></a>
995
+
996
+ ```typescript
997
+ public readonly roleName: string;
998
+ ```
999
+
1000
+ - *Type:* string
1001
+
1002
+ Returns the name of the role.
1003
+
1004
+ ---
1005
+
1006
+ ##### `roleRef`<sup>Required</sup> <a name="roleRef" id="aws-cdk-github-oidc.GithubActionsRole.property.roleRef"></a>
1007
+
1008
+ ```typescript
1009
+ public readonly roleRef: RoleReference;
1010
+ ```
1011
+
1012
+ - *Type:* aws-cdk-lib.aws_iam.RoleReference
1013
+
1014
+ A reference to a Role resource.
1015
+
1016
+ ---
1017
+
1018
+ ##### `assumeRolePolicy`<sup>Optional</sup> <a name="assumeRolePolicy" id="aws-cdk-github-oidc.GithubActionsRole.property.assumeRolePolicy"></a>
1019
+
1020
+ ```typescript
1021
+ public readonly assumeRolePolicy: PolicyDocument;
1022
+ ```
1023
+
1024
+ - *Type:* aws-cdk-lib.aws_iam.PolicyDocument
1025
+
1026
+ The assume role policy document associated with this role.
1027
+
1028
+ ---
1029
+
1030
+ ##### `permissionsBoundary`<sup>Optional</sup> <a name="permissionsBoundary" id="aws-cdk-github-oidc.GithubActionsRole.property.permissionsBoundary"></a>
1031
+
1032
+ ```typescript
1033
+ public readonly permissionsBoundary: IManagedPolicy;
1034
+ ```
1035
+
1036
+ - *Type:* aws-cdk-lib.aws_iam.IManagedPolicy
1037
+
1038
+ Returns the permissions boundary attached to this role.
1039
+
1040
+ ---
1041
+
1042
+ ##### `principalAccount`<sup>Optional</sup> <a name="principalAccount" id="aws-cdk-github-oidc.GithubActionsRole.property.principalAccount"></a>
1043
+
1044
+ ```typescript
1045
+ public readonly principalAccount: string;
1046
+ ```
1047
+
1048
+ - *Type:* string
1049
+
1050
+ The AWS account ID of this principal.
1051
+
1052
+ Can be undefined when the account is not known
1053
+ (for example, for service principals).
1054
+ Can be a Token - in that case,
1055
+ it's assumed to be AWS::AccountId.
99
1056
 
100
1057
  ---
101
1058
 
102
- ##### `props`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsRole.parameter.props"></a>
1059
+ #### Constants <a name="Constants" id="Constants"></a>
103
1060
 
104
- - *Type:* [`aws-cdk-github-oidc.GithubActionsRoleProps`](#aws-cdk-github-oidc.GithubActionsRoleProps)
1061
+ | **Name** | **Type** | **Description** |
1062
+ | --- | --- | --- |
1063
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRole.property.PROPERTY_INJECTION_ID">PROPERTY_INJECTION_ID</a></code> | <code>string</code> | Uniquely identifies this class. |
105
1064
 
106
1065
  ---
107
1066
 
1067
+ ##### `PROPERTY_INJECTION_ID`<sup>Required</sup> <a name="PROPERTY_INJECTION_ID" id="aws-cdk-github-oidc.GithubActionsRole.property.PROPERTY_INJECTION_ID"></a>
108
1068
 
1069
+ ```typescript
1070
+ public readonly PROPERTY_INJECTION_ID: string;
1071
+ ```
109
1072
 
1073
+ - *Type:* string
110
1074
 
1075
+ Uniquely identifies this class.
1076
+
1077
+ ---
111
1078
 
112
- ## Structs <a name="Structs"></a>
1079
+ ## Structs <a name="Structs" id="Structs"></a>
113
1080
 
114
- ### GithubActionsRoleProps <a name="aws-cdk-github-oidc.GithubActionsRoleProps"></a>
1081
+ ### GithubActionsRoleProps <a name="GithubActionsRoleProps" id="aws-cdk-github-oidc.GithubActionsRoleProps"></a>
115
1082
 
116
1083
  Props that define the IAM Role that can be assumed by Github Actions workflow via Github OpenID Connect Identity Provider.
117
1084
 
118
1085
  Besides `GithubConfiguration`, you may pass in any `iam.RoleProps` except `assumedBy`
119
1086
  which will be defined by this construct (CDK will fail if you do).
120
1087
 
121
- #### Initializer <a name="[object Object].Initializer"></a>
1088
+ *Example*
1089
+
1090
+ ```typescript
1091
+ {
1092
+ provider: GithubActionsIdentityProvider.fromAccount(scope, "GithubProvider"),
1093
+ owner: 'octo-org',
1094
+ repo: 'octo-repo',
1095
+ filter: 'ref:refs/tags/v*',
1096
+ roleName: 'MyDeployRole',
1097
+ }
1098
+ ```
1099
+
1100
+
1101
+ #### Initializer <a name="Initializer" id="aws-cdk-github-oidc.GithubActionsRoleProps.Initializer"></a>
122
1102
 
123
1103
  ```typescript
124
1104
  import { GithubActionsRoleProps } from 'aws-cdk-github-oidc'
@@ -126,25 +1106,51 @@ import { GithubActionsRoleProps } from 'aws-cdk-github-oidc'
126
1106
  const githubActionsRoleProps: GithubActionsRoleProps = { ... }
127
1107
  ```
128
1108
 
129
- ##### `owner`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.owner"></a>
1109
+ #### Properties <a name="Properties" id="Properties"></a>
1110
+
1111
+ | **Name** | **Type** | **Description** |
1112
+ | --- | --- | --- |
1113
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.owner">owner</a></code> | <code>string</code> | Repository owner (organization or username). |
1114
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.provider">provider</a></code> | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider">IGithubActionsIdentityProvider</a></code> | Reference to Github OpenID Connect Provider configured in AWS IAM. |
1115
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.repo">repo</a></code> | <code>string</code> | Repository name (slug) without the owner. |
1116
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.filter">filter</a></code> | <code>string</code> | Subject condition filter, appended after `repo:${owner}/${repo}:` string in IAM Role trust relationship. |
1117
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.description">description</a></code> | <code>string</code> | A description of the role. |
1118
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.externalIds">externalIds</a></code> | <code>string[]</code> | List of IDs that the role assumer needs to provide one of when assuming this role. |
1119
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.inlinePolicies">inlinePolicies</a></code> | <code>{[ key: string ]: aws-cdk-lib.aws_iam.PolicyDocument}</code> | A list of named policies to inline into this role. |
1120
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.managedPolicies">managedPolicies</a></code> | <code>aws-cdk-lib.aws_iam.IManagedPolicy[]</code> | A list of managed policies associated with this role. |
1121
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.maxSessionDuration">maxSessionDuration</a></code> | <code>aws-cdk-lib.Duration</code> | The maximum session duration that you want to set for the specified role. |
1122
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.path">path</a></code> | <code>string</code> | The path associated with this role. |
1123
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.permissionsBoundary">permissionsBoundary</a></code> | <code>aws-cdk-lib.aws_iam.IManagedPolicy</code> | AWS supports permissions boundaries for IAM entities (users or roles). |
1124
+ | <code><a href="#aws-cdk-github-oidc.GithubActionsRoleProps.property.roleName">roleName</a></code> | <code>string</code> | A name for the IAM role. |
1125
+
1126
+ ---
1127
+
1128
+ ##### `owner`<sup>Required</sup> <a name="owner" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.owner"></a>
130
1129
 
131
1130
  ```typescript
132
1131
  public readonly owner: string;
133
1132
  ```
134
1133
 
135
- - *Type:* `string`
1134
+ - *Type:* string
136
1135
 
137
1136
  Repository owner (organization or username).
138
1137
 
139
1138
  ---
140
1139
 
141
- ##### `provider`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.provider"></a>
1140
+ *Example*
1141
+
1142
+ ```typescript
1143
+ 'octo-org'
1144
+ ```
1145
+
1146
+
1147
+ ##### `provider`<sup>Required</sup> <a name="provider" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.provider"></a>
142
1148
 
143
1149
  ```typescript
144
1150
  public readonly provider: IGithubActionsIdentityProvider;
145
1151
  ```
146
1152
 
147
- - *Type:* [`aws-cdk-github-oidc.IGithubActionsIdentityProvider`](#aws-cdk-github-oidc.IGithubActionsIdentityProvider)
1153
+ - *Type:* <a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider">IGithubActionsIdentityProvider</a>
148
1154
 
149
1155
  Reference to Github OpenID Connect Provider configured in AWS IAM.
150
1156
 
@@ -154,42 +1160,57 @@ There can be only one (per AWS Account).
154
1160
 
155
1161
  ---
156
1162
 
157
- ##### `repo`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.repo"></a>
1163
+ ##### `repo`<sup>Required</sup> <a name="repo" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.repo"></a>
158
1164
 
159
1165
  ```typescript
160
1166
  public readonly repo: string;
161
1167
  ```
162
1168
 
163
- - *Type:* `string`
1169
+ - *Type:* string
164
1170
 
165
1171
  Repository name (slug) without the owner.
166
1172
 
167
1173
  ---
168
1174
 
169
- ##### `filter`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.filter"></a>
1175
+ *Example*
170
1176
 
171
1177
  ```typescript
172
- public readonly filter: string;
1178
+ 'octo-repo'
173
1179
  ```
174
1180
 
175
- - *Type:* `string`
176
- - *Default:* '*'
177
1181
 
178
- You may use this value to only allow Github to assume the role on specific branches, tags, environments, pull requests etc.
1182
+ ##### `filter`<sup>Optional</sup> <a name="filter" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.filter"></a>
1183
+
1184
+ ```typescript
1185
+ public readonly filter: string;
1186
+ ```
1187
+
1188
+ - *Type:* string
1189
+ - *Default:* '*' You may use this value to only allow Github to assume the role on specific branches, tags, environments, pull requests etc.
179
1190
 
180
1191
  Subject condition filter, appended after `repo:${owner}/${repo}:` string in IAM Role trust relationship.
181
1192
 
182
- > https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#examples
1193
+ > [https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#examples](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#examples)
183
1194
 
184
1195
  ---
185
1196
 
186
- ##### `description`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.description"></a>
1197
+ *Example*
1198
+
1199
+ ```typescript
1200
+ 'ref:refs/tags/v*'
1201
+ 'ref:refs/heads/demo-branch'
1202
+ 'pull_request'
1203
+ 'environment:Production'
1204
+ ```
1205
+
1206
+
1207
+ ##### `description`<sup>Optional</sup> <a name="description" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.description"></a>
187
1208
 
188
1209
  ```typescript
189
1210
  public readonly description: string;
190
1211
  ```
191
1212
 
192
- - *Type:* `string`
1213
+ - *Type:* string
193
1214
  - *Default:* No description.
194
1215
 
195
1216
  A description of the role.
@@ -198,13 +1219,13 @@ It can be up to 1000 characters long.
198
1219
 
199
1220
  ---
200
1221
 
201
- ##### `externalIds`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.externalIds"></a>
1222
+ ##### `externalIds`<sup>Optional</sup> <a name="externalIds" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.externalIds"></a>
202
1223
 
203
1224
  ```typescript
204
1225
  public readonly externalIds: string[];
205
1226
  ```
206
1227
 
207
- - *Type:* `string`[]
1228
+ - *Type:* string[]
208
1229
  - *Default:* No external ID required
209
1230
 
210
1231
  List of IDs that the role assumer needs to provide one of when assuming this role.
@@ -214,13 +1235,13 @@ AssumeRole operation will fail.
214
1235
 
215
1236
  ---
216
1237
 
217
- ##### `inlinePolicies`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.inlinePolicies"></a>
1238
+ ##### `inlinePolicies`<sup>Optional</sup> <a name="inlinePolicies" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.inlinePolicies"></a>
218
1239
 
219
1240
  ```typescript
220
1241
  public readonly inlinePolicies: {[ key: string ]: PolicyDocument};
221
1242
  ```
222
1243
 
223
- - *Type:* {[ key: string ]: [`aws-cdk-lib.aws_iam.PolicyDocument`](#aws-cdk-lib.aws_iam.PolicyDocument)}
1244
+ - *Type:* {[ key: string ]: aws-cdk-lib.aws_iam.PolicyDocument}
224
1245
  - *Default:* No policy is inlined in the Role resource.
225
1246
 
226
1247
  A list of named policies to inline into this role.
@@ -232,13 +1253,13 @@ dependencies that could otherwise be introduced).
232
1253
 
233
1254
  ---
234
1255
 
235
- ##### `managedPolicies`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.managedPolicies"></a>
1256
+ ##### `managedPolicies`<sup>Optional</sup> <a name="managedPolicies" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.managedPolicies"></a>
236
1257
 
237
1258
  ```typescript
238
1259
  public readonly managedPolicies: IManagedPolicy[];
239
1260
  ```
240
1261
 
241
- - *Type:* [`aws-cdk-lib.aws_iam.IManagedPolicy`](#aws-cdk-lib.aws_iam.IManagedPolicy)[]
1262
+ - *Type:* aws-cdk-lib.aws_iam.IManagedPolicy[]
242
1263
  - *Default:* No managed policies.
243
1264
 
244
1265
  A list of managed policies associated with this role.
@@ -248,13 +1269,13 @@ You can add managed policies later using
248
1269
 
249
1270
  ---
250
1271
 
251
- ##### `maxSessionDuration`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.maxSessionDuration"></a>
1272
+ ##### `maxSessionDuration`<sup>Optional</sup> <a name="maxSessionDuration" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.maxSessionDuration"></a>
252
1273
 
253
1274
  ```typescript
254
1275
  public readonly maxSessionDuration: Duration;
255
1276
  ```
256
1277
 
257
- - *Type:* [`aws-cdk-lib.Duration`](#aws-cdk-lib.Duration)
1278
+ - *Type:* aws-cdk-lib.Duration
258
1279
  - *Default:* Duration.hours(1)
259
1280
 
260
1281
  The maximum session duration that you want to set for the specified role.
@@ -276,13 +1297,13 @@ but does not apply when you use those operations to create a console URL.
276
1297
 
277
1298
  ---
278
1299
 
279
- ##### `path`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.path"></a>
1300
+ ##### `path`<sup>Optional</sup> <a name="path" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.path"></a>
280
1301
 
281
1302
  ```typescript
282
1303
  public readonly path: string;
283
1304
  ```
284
1305
 
285
- - *Type:* `string`
1306
+ - *Type:* string
286
1307
  - *Default:* /
287
1308
 
288
1309
  The path associated with this role.
@@ -292,13 +1313,13 @@ Friendly Names and Paths in IAM User Guide.
292
1313
 
293
1314
  ---
294
1315
 
295
- ##### `permissionsBoundary`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.permissionsBoundary"></a>
1316
+ ##### `permissionsBoundary`<sup>Optional</sup> <a name="permissionsBoundary" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.permissionsBoundary"></a>
296
1317
 
297
1318
  ```typescript
298
1319
  public readonly permissionsBoundary: IManagedPolicy;
299
1320
  ```
300
1321
 
301
- - *Type:* [`aws-cdk-lib.aws_iam.IManagedPolicy`](#aws-cdk-lib.aws_iam.IManagedPolicy)
1322
+ - *Type:* aws-cdk-lib.aws_iam.IManagedPolicy
302
1323
  - *Default:* No permissions boundary.
303
1324
 
304
1325
  AWS supports permissions boundaries for IAM entities (users or roles).
@@ -313,15 +1334,14 @@ permissions boundaries.
313
1334
 
314
1335
  ---
315
1336
 
316
- ##### `roleName`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubActionsRoleProps.property.roleName"></a>
1337
+ ##### `roleName`<sup>Optional</sup> <a name="roleName" id="aws-cdk-github-oidc.GithubActionsRoleProps.property.roleName"></a>
317
1338
 
318
1339
  ```typescript
319
1340
  public readonly roleName: string;
320
1341
  ```
321
1342
 
322
- - *Type:* `string`
323
- - *Default:* AWS CloudFormation generates a unique physical ID and uses that ID
324
- for the role name.
1343
+ - *Type:* string
1344
+ - *Default:* AWS CloudFormation generates a unique physical ID and uses that ID for the role name.
325
1345
 
326
1346
  A name for the IAM role.
327
1347
 
@@ -338,11 +1358,11 @@ Acknowledging IAM Resources in AWS CloudFormation Templates.
338
1358
 
339
1359
  ---
340
1360
 
341
- ### GithubConfiguration <a name="aws-cdk-github-oidc.GithubConfiguration"></a>
1361
+ ### GithubConfiguration <a name="GithubConfiguration" id="aws-cdk-github-oidc.GithubConfiguration"></a>
342
1362
 
343
1363
  Github related configuration that forms the trust policy for this IAM Role.
344
1364
 
345
- #### Initializer <a name="[object Object].Initializer"></a>
1365
+ #### Initializer <a name="Initializer" id="aws-cdk-github-oidc.GithubConfiguration.Initializer"></a>
346
1366
 
347
1367
  ```typescript
348
1368
  import { GithubConfiguration } from 'aws-cdk-github-oidc'
@@ -350,25 +1370,43 @@ import { GithubConfiguration } from 'aws-cdk-github-oidc'
350
1370
  const githubConfiguration: GithubConfiguration = { ... }
351
1371
  ```
352
1372
 
353
- ##### `owner`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubConfiguration.property.owner"></a>
1373
+ #### Properties <a name="Properties" id="Properties"></a>
1374
+
1375
+ | **Name** | **Type** | **Description** |
1376
+ | --- | --- | --- |
1377
+ | <code><a href="#aws-cdk-github-oidc.GithubConfiguration.property.owner">owner</a></code> | <code>string</code> | Repository owner (organization or username). |
1378
+ | <code><a href="#aws-cdk-github-oidc.GithubConfiguration.property.provider">provider</a></code> | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider">IGithubActionsIdentityProvider</a></code> | Reference to Github OpenID Connect Provider configured in AWS IAM. |
1379
+ | <code><a href="#aws-cdk-github-oidc.GithubConfiguration.property.repo">repo</a></code> | <code>string</code> | Repository name (slug) without the owner. |
1380
+ | <code><a href="#aws-cdk-github-oidc.GithubConfiguration.property.filter">filter</a></code> | <code>string</code> | Subject condition filter, appended after `repo:${owner}/${repo}:` string in IAM Role trust relationship. |
1381
+
1382
+ ---
1383
+
1384
+ ##### `owner`<sup>Required</sup> <a name="owner" id="aws-cdk-github-oidc.GithubConfiguration.property.owner"></a>
354
1385
 
355
1386
  ```typescript
356
1387
  public readonly owner: string;
357
1388
  ```
358
1389
 
359
- - *Type:* `string`
1390
+ - *Type:* string
360
1391
 
361
1392
  Repository owner (organization or username).
362
1393
 
363
1394
  ---
364
1395
 
365
- ##### `provider`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubConfiguration.property.provider"></a>
1396
+ *Example*
1397
+
1398
+ ```typescript
1399
+ 'octo-org'
1400
+ ```
1401
+
1402
+
1403
+ ##### `provider`<sup>Required</sup> <a name="provider" id="aws-cdk-github-oidc.GithubConfiguration.property.provider"></a>
366
1404
 
367
1405
  ```typescript
368
1406
  public readonly provider: IGithubActionsIdentityProvider;
369
1407
  ```
370
1408
 
371
- - *Type:* [`aws-cdk-github-oidc.IGithubActionsIdentityProvider`](#aws-cdk-github-oidc.IGithubActionsIdentityProvider)
1409
+ - *Type:* <a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider">IGithubActionsIdentityProvider</a>
372
1410
 
373
1411
  Reference to Github OpenID Connect Provider configured in AWS IAM.
374
1412
 
@@ -378,45 +1416,57 @@ There can be only one (per AWS Account).
378
1416
 
379
1417
  ---
380
1418
 
381
- ##### `repo`<sup>Required</sup> <a name="aws-cdk-github-oidc.GithubConfiguration.property.repo"></a>
1419
+ ##### `repo`<sup>Required</sup> <a name="repo" id="aws-cdk-github-oidc.GithubConfiguration.property.repo"></a>
382
1420
 
383
1421
  ```typescript
384
1422
  public readonly repo: string;
385
1423
  ```
386
1424
 
387
- - *Type:* `string`
1425
+ - *Type:* string
388
1426
 
389
1427
  Repository name (slug) without the owner.
390
1428
 
391
1429
  ---
392
1430
 
393
- ##### `filter`<sup>Optional</sup> <a name="aws-cdk-github-oidc.GithubConfiguration.property.filter"></a>
1431
+ *Example*
394
1432
 
395
1433
  ```typescript
396
- public readonly filter: string;
1434
+ 'octo-repo'
397
1435
  ```
398
1436
 
399
- - *Type:* `string`
400
- - *Default:* '*'
401
1437
 
402
- You may use this value to only allow Github to assume the role on specific branches, tags, environments, pull requests etc.
1438
+ ##### `filter`<sup>Optional</sup> <a name="filter" id="aws-cdk-github-oidc.GithubConfiguration.property.filter"></a>
1439
+
1440
+ ```typescript
1441
+ public readonly filter: string;
1442
+ ```
1443
+
1444
+ - *Type:* string
1445
+ - *Default:* '*' You may use this value to only allow Github to assume the role on specific branches, tags, environments, pull requests etc.
403
1446
 
404
1447
  Subject condition filter, appended after `repo:${owner}/${repo}:` string in IAM Role trust relationship.
405
1448
 
406
- > https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#examples
1449
+ > [https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#examples](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#examples)
407
1450
 
408
1451
  ---
409
1452
 
410
- ### RoleProps <a name="aws-cdk-github-oidc.RoleProps"></a>
1453
+ *Example*
411
1454
 
412
- Properties for defining an IAM Role.
1455
+ ```typescript
1456
+ 'ref:refs/tags/v*'
1457
+ 'ref:refs/heads/demo-branch'
1458
+ 'pull_request'
1459
+ 'environment:Production'
1460
+ ```
1461
+
1462
+
1463
+ ### RoleProps <a name="RoleProps" id="aws-cdk-github-oidc.RoleProps"></a>
413
1464
 
414
- These are copied fron @aws-cdk/aws-iam, but since JSII does not support
415
- TypeScript <Partial<iam.RoleProps>> (or Omit), we have to do this stupid thing.
1465
+ Properties for defining an IAM Role.
416
1466
 
417
- Basically exactly the same as source, but with assumedBy removed.
1467
+ These are copied fron
418
1468
 
419
- #### Initializer <a name="[object Object].Initializer"></a>
1469
+ #### Initializer <a name="Initializer" id="aws-cdk-github-oidc.RoleProps.Initializer"></a>
420
1470
 
421
1471
  ```typescript
422
1472
  import { RoleProps } from 'aws-cdk-github-oidc'
@@ -424,13 +1474,28 @@ import { RoleProps } from 'aws-cdk-github-oidc'
424
1474
  const roleProps: RoleProps = { ... }
425
1475
  ```
426
1476
 
427
- ##### `description`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.description"></a>
1477
+ #### Properties <a name="Properties" id="Properties"></a>
1478
+
1479
+ | **Name** | **Type** | **Description** |
1480
+ | --- | --- | --- |
1481
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.description">description</a></code> | <code>string</code> | A description of the role. |
1482
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.externalIds">externalIds</a></code> | <code>string[]</code> | List of IDs that the role assumer needs to provide one of when assuming this role. |
1483
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.inlinePolicies">inlinePolicies</a></code> | <code>{[ key: string ]: aws-cdk-lib.aws_iam.PolicyDocument}</code> | A list of named policies to inline into this role. |
1484
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.managedPolicies">managedPolicies</a></code> | <code>aws-cdk-lib.aws_iam.IManagedPolicy[]</code> | A list of managed policies associated with this role. |
1485
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.maxSessionDuration">maxSessionDuration</a></code> | <code>aws-cdk-lib.Duration</code> | The maximum session duration that you want to set for the specified role. |
1486
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.path">path</a></code> | <code>string</code> | The path associated with this role. |
1487
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.permissionsBoundary">permissionsBoundary</a></code> | <code>aws-cdk-lib.aws_iam.IManagedPolicy</code> | AWS supports permissions boundaries for IAM entities (users or roles). |
1488
+ | <code><a href="#aws-cdk-github-oidc.RoleProps.property.roleName">roleName</a></code> | <code>string</code> | A name for the IAM role. |
1489
+
1490
+ ---
1491
+
1492
+ ##### `description`<sup>Optional</sup> <a name="description" id="aws-cdk-github-oidc.RoleProps.property.description"></a>
428
1493
 
429
1494
  ```typescript
430
1495
  public readonly description: string;
431
1496
  ```
432
1497
 
433
- - *Type:* `string`
1498
+ - *Type:* string
434
1499
  - *Default:* No description.
435
1500
 
436
1501
  A description of the role.
@@ -439,13 +1504,13 @@ It can be up to 1000 characters long.
439
1504
 
440
1505
  ---
441
1506
 
442
- ##### `externalIds`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.externalIds"></a>
1507
+ ##### `externalIds`<sup>Optional</sup> <a name="externalIds" id="aws-cdk-github-oidc.RoleProps.property.externalIds"></a>
443
1508
 
444
1509
  ```typescript
445
1510
  public readonly externalIds: string[];
446
1511
  ```
447
1512
 
448
- - *Type:* `string`[]
1513
+ - *Type:* string[]
449
1514
  - *Default:* No external ID required
450
1515
 
451
1516
  List of IDs that the role assumer needs to provide one of when assuming this role.
@@ -455,13 +1520,13 @@ AssumeRole operation will fail.
455
1520
 
456
1521
  ---
457
1522
 
458
- ##### `inlinePolicies`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.inlinePolicies"></a>
1523
+ ##### `inlinePolicies`<sup>Optional</sup> <a name="inlinePolicies" id="aws-cdk-github-oidc.RoleProps.property.inlinePolicies"></a>
459
1524
 
460
1525
  ```typescript
461
1526
  public readonly inlinePolicies: {[ key: string ]: PolicyDocument};
462
1527
  ```
463
1528
 
464
- - *Type:* {[ key: string ]: [`aws-cdk-lib.aws_iam.PolicyDocument`](#aws-cdk-lib.aws_iam.PolicyDocument)}
1529
+ - *Type:* {[ key: string ]: aws-cdk-lib.aws_iam.PolicyDocument}
465
1530
  - *Default:* No policy is inlined in the Role resource.
466
1531
 
467
1532
  A list of named policies to inline into this role.
@@ -473,13 +1538,13 @@ dependencies that could otherwise be introduced).
473
1538
 
474
1539
  ---
475
1540
 
476
- ##### `managedPolicies`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.managedPolicies"></a>
1541
+ ##### `managedPolicies`<sup>Optional</sup> <a name="managedPolicies" id="aws-cdk-github-oidc.RoleProps.property.managedPolicies"></a>
477
1542
 
478
1543
  ```typescript
479
1544
  public readonly managedPolicies: IManagedPolicy[];
480
1545
  ```
481
1546
 
482
- - *Type:* [`aws-cdk-lib.aws_iam.IManagedPolicy`](#aws-cdk-lib.aws_iam.IManagedPolicy)[]
1547
+ - *Type:* aws-cdk-lib.aws_iam.IManagedPolicy[]
483
1548
  - *Default:* No managed policies.
484
1549
 
485
1550
  A list of managed policies associated with this role.
@@ -489,13 +1554,13 @@ You can add managed policies later using
489
1554
 
490
1555
  ---
491
1556
 
492
- ##### `maxSessionDuration`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.maxSessionDuration"></a>
1557
+ ##### `maxSessionDuration`<sup>Optional</sup> <a name="maxSessionDuration" id="aws-cdk-github-oidc.RoleProps.property.maxSessionDuration"></a>
493
1558
 
494
1559
  ```typescript
495
1560
  public readonly maxSessionDuration: Duration;
496
1561
  ```
497
1562
 
498
- - *Type:* [`aws-cdk-lib.Duration`](#aws-cdk-lib.Duration)
1563
+ - *Type:* aws-cdk-lib.Duration
499
1564
  - *Default:* Duration.hours(1)
500
1565
 
501
1566
  The maximum session duration that you want to set for the specified role.
@@ -517,13 +1582,13 @@ but does not apply when you use those operations to create a console URL.
517
1582
 
518
1583
  ---
519
1584
 
520
- ##### `path`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.path"></a>
1585
+ ##### `path`<sup>Optional</sup> <a name="path" id="aws-cdk-github-oidc.RoleProps.property.path"></a>
521
1586
 
522
1587
  ```typescript
523
1588
  public readonly path: string;
524
1589
  ```
525
1590
 
526
- - *Type:* `string`
1591
+ - *Type:* string
527
1592
  - *Default:* /
528
1593
 
529
1594
  The path associated with this role.
@@ -533,13 +1598,13 @@ Friendly Names and Paths in IAM User Guide.
533
1598
 
534
1599
  ---
535
1600
 
536
- ##### `permissionsBoundary`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.permissionsBoundary"></a>
1601
+ ##### `permissionsBoundary`<sup>Optional</sup> <a name="permissionsBoundary" id="aws-cdk-github-oidc.RoleProps.property.permissionsBoundary"></a>
537
1602
 
538
1603
  ```typescript
539
1604
  public readonly permissionsBoundary: IManagedPolicy;
540
1605
  ```
541
1606
 
542
- - *Type:* [`aws-cdk-lib.aws_iam.IManagedPolicy`](#aws-cdk-lib.aws_iam.IManagedPolicy)
1607
+ - *Type:* aws-cdk-lib.aws_iam.IManagedPolicy
543
1608
  - *Default:* No permissions boundary.
544
1609
 
545
1610
  AWS supports permissions boundaries for IAM entities (users or roles).
@@ -554,15 +1619,14 @@ permissions boundaries.
554
1619
 
555
1620
  ---
556
1621
 
557
- ##### `roleName`<sup>Optional</sup> <a name="aws-cdk-github-oidc.RoleProps.property.roleName"></a>
1622
+ ##### `roleName`<sup>Optional</sup> <a name="roleName" id="aws-cdk-github-oidc.RoleProps.property.roleName"></a>
558
1623
 
559
1624
  ```typescript
560
1625
  public readonly roleName: string;
561
1626
  ```
562
1627
 
563
- - *Type:* `string`
564
- - *Default:* AWS CloudFormation generates a unique physical ID and uses that ID
565
- for the role name.
1628
+ - *Type:* string
1629
+ - *Default:* AWS CloudFormation generates a unique physical ID and uses that ID for the role name.
566
1630
 
567
1631
  A name for the IAM role.
568
1632
 
@@ -580,38 +1644,49 @@ Acknowledging IAM Resources in AWS CloudFormation Templates.
580
1644
  ---
581
1645
 
582
1646
 
583
- ## Protocols <a name="Protocols"></a>
1647
+ ## Protocols <a name="Protocols" id="Protocols"></a>
584
1648
 
585
- ### IGithubActionsIdentityProvider <a name="aws-cdk-github-oidc.IGithubActionsIdentityProvider"></a>
1649
+ ### IGithubActionsIdentityProvider <a name="IGithubActionsIdentityProvider" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider"></a>
586
1650
 
587
- - *Extends:* [`aws-cdk-lib.aws_iam.IOpenIdConnectProvider`](#aws-cdk-lib.aws_iam.IOpenIdConnectProvider)
1651
+ - *Extends:* aws-cdk-lib.aws_iam.IOpenIdConnectProvider
588
1652
 
589
- - *Implemented By:* [`aws-cdk-github-oidc.GithubActionsIdentityProvider`](#aws-cdk-github-oidc.GithubActionsIdentityProvider), [`aws-cdk-github-oidc.IGithubActionsIdentityProvider`](#aws-cdk-github-oidc.IGithubActionsIdentityProvider)
1653
+ - *Implemented By:* <a href="#aws-cdk-github-oidc.GithubActionsIdentityProvider">GithubActionsIdentityProvider</a>, <a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider">IGithubActionsIdentityProvider</a>
590
1654
 
591
1655
  Describes a Github OpenID Connect Identity Provider for AWS IAM.
592
1656
 
593
1657
 
594
- #### Properties <a name="Properties"></a>
1658
+ #### Properties <a name="Properties" id="Properties"></a>
1659
+
1660
+ | **Name** | **Type** | **Description** |
1661
+ | --- | --- | --- |
1662
+ | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
1663
+ | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. |
1664
+ | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
1665
+ | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.oidcProviderRef">oidcProviderRef</a></code> | <code>aws-cdk-lib.aws_iam.OIDCProviderReference</code> | A reference to a OIDCProvider resource. |
1666
+ | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.openIdConnectProviderArn">openIdConnectProviderArn</a></code> | <code>string</code> | The Amazon Resource Name (ARN) of the IAM OpenID Connect provider. |
1667
+ | <code><a href="#aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.openIdConnectProviderIssuer">openIdConnectProviderIssuer</a></code> | <code>string</code> | The issuer for OIDC Provider. |
1668
+
1669
+ ---
595
1670
 
596
- ##### `node`<sup>Required</sup> <a name="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.node"></a>
1671
+ ##### `node`<sup>Required</sup> <a name="node" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.node"></a>
597
1672
 
598
1673
  ```typescript
599
1674
  public readonly node: Node;
600
1675
  ```
601
1676
 
602
- - *Type:* [`constructs.Node`](#constructs.Node)
1677
+ - *Type:* constructs.Node
603
1678
 
604
1679
  The tree node.
605
1680
 
606
1681
  ---
607
1682
 
608
- ##### `env`<sup>Required</sup> <a name="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.env"></a>
1683
+ ##### `env`<sup>Required</sup> <a name="env" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.env"></a>
609
1684
 
610
1685
  ```typescript
611
1686
  public readonly env: ResourceEnvironment;
612
1687
  ```
613
1688
 
614
- - *Type:* [`aws-cdk-lib.ResourceEnvironment`](#aws-cdk-lib.ResourceEnvironment)
1689
+ - *Type:* aws-cdk-lib.ResourceEnvironment
615
1690
 
616
1691
  The environment this resource belongs to.
617
1692
 
@@ -624,37 +1699,49 @@ that might be different than the stack they were imported into.
624
1699
 
625
1700
  ---
626
1701
 
627
- ##### `stack`<sup>Required</sup> <a name="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.stack"></a>
1702
+ ##### `stack`<sup>Required</sup> <a name="stack" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.stack"></a>
628
1703
 
629
1704
  ```typescript
630
1705
  public readonly stack: Stack;
631
1706
  ```
632
1707
 
633
- - *Type:* [`aws-cdk-lib.Stack`](#aws-cdk-lib.Stack)
1708
+ - *Type:* aws-cdk-lib.Stack
634
1709
 
635
1710
  The stack in which this resource is defined.
636
1711
 
637
1712
  ---
638
1713
 
639
- ##### `openIdConnectProviderArn`<sup>Required</sup> <a name="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.openIdConnectProviderArn"></a>
1714
+ ##### `oidcProviderRef`<sup>Required</sup> <a name="oidcProviderRef" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.oidcProviderRef"></a>
1715
+
1716
+ ```typescript
1717
+ public readonly oidcProviderRef: OIDCProviderReference;
1718
+ ```
1719
+
1720
+ - *Type:* aws-cdk-lib.aws_iam.OIDCProviderReference
1721
+
1722
+ A reference to a OIDCProvider resource.
1723
+
1724
+ ---
1725
+
1726
+ ##### `openIdConnectProviderArn`<sup>Required</sup> <a name="openIdConnectProviderArn" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.openIdConnectProviderArn"></a>
640
1727
 
641
1728
  ```typescript
642
1729
  public readonly openIdConnectProviderArn: string;
643
1730
  ```
644
1731
 
645
- - *Type:* `string`
1732
+ - *Type:* string
646
1733
 
647
1734
  The Amazon Resource Name (ARN) of the IAM OpenID Connect provider.
648
1735
 
649
1736
  ---
650
1737
 
651
- ##### `openIdConnectProviderIssuer`<sup>Required</sup> <a name="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.openIdConnectProviderIssuer"></a>
1738
+ ##### `openIdConnectProviderIssuer`<sup>Required</sup> <a name="openIdConnectProviderIssuer" id="aws-cdk-github-oidc.IGithubActionsIdentityProvider.property.openIdConnectProviderIssuer"></a>
652
1739
 
653
1740
  ```typescript
654
1741
  public readonly openIdConnectProviderIssuer: string;
655
1742
  ```
656
1743
 
657
- - *Type:* `string`
1744
+ - *Type:* string
658
1745
 
659
1746
  The issuer for OIDC Provider.
660
1747