

# PutWorkloadIdentityProviderResourcePolicy

Attaches a resource policy to a workload identity provider, or replaces the one attached. A provider carries at most one resource policy, and the policy is a property of the provider rather than a resource of its own.

A member account binding to an organization-scoped provider needs a matching `Allow` here for `iam:AssociateWorkloadIdentityTemplate` or `iam:DisassociateWorkloadIdentityTemplate`, in addition to its own identity policy.

## Request Parameters
<a name="API_PutWorkloadIdentityProviderResourcePolicy_RequestParameters"></a>

 For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

 ** PolicyDocument **   
The resource policy to attach, written whole.  
Application-level quotas can bind sooner than the length constraint shown here, in which case the request returns `LimitExceededException`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 131072.  
Pattern: `[\u0009\u000A\u000D\u0020-\u00FF]+`   
Required: Yes

 ** WorkloadIdentityProviderArn **   
The Amazon Resource Name (ARN) of the provider to attach the policy to.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.  
Required: Yes

## Errors
<a name="API_PutWorkloadIdentityProviderResourcePolicy_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ConcurrentModification **   
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.  
HTTP Status Code: 409

 ** InvalidInput **   
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.  
HTTP Status Code: 400

 ** LimitExceeded **   
The request was rejected because it attempted to create resources beyond the current AWS account limits. The error message describes the limit exceeded.  
HTTP Status Code: 409

 ** MalformedPolicyDocument **   
The request was rejected because the policy document was malformed. The error message describes the specific error.  
HTTP Status Code: 400

 ** NoSuchEntity **   
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.  
HTTP Status Code: 404

 ** ServiceFailure **   
The request processing has failed because of an unknown error, exception or failure.  
HTTP Status Code: 500

## Examples
<a name="API_PutWorkloadIdentityProviderResourcePolicy_Examples"></a>

### Example
<a name="API_PutWorkloadIdentityProviderResourcePolicy_Example_1"></a>

The following example is formatted with line breaks for legibility.

#### Sample Request
<a name="API_PutWorkloadIdentityProviderResourcePolicy_Example_1_Request"></a>

```
https://iam.amazonaws.com/?Action=PutWorkloadIdentityProviderResourcePolicy
&WorkloadIdentityProviderArn=arn:aws:iam::111122223333:workload-identity-provider/PaymentsProd
&PolicyDocument={"Version":"2012-10-17","Statement":[{"Effect":"Allow",
  "Principal":{"AWS":"arn:aws:iam::444455556666:root"},
  "Action":["iam:AssociateWorkloadIdentityTemplate"],
  "Resource":"arn:aws:iam::111122223333:workload-identity-provider/PaymentsProd"}]}
&Version=2010-05-08
&AUTHPARAMS
```

#### Sample Response
<a name="API_PutWorkloadIdentityProviderResourcePolicy_Example_1_Response"></a>

```xml
<PutWorkloadIdentityProviderResourcePolicyResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
  <ResponseMetadata>
    <RequestId>f1f9a3a5-99ed-11e1-a4c3-270EXAMPLE04</RequestId>
  </ResponseMetadata>
</PutWorkloadIdentityProviderResourcePolicyResponse>
```

## See Also
<a name="API_PutWorkloadIdentityProviderResourcePolicy_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/iam-2010-05-08/PutWorkloadIdentityProviderResourcePolicy) 