Class LogResourcePolicy
Provides a resource to manage a CloudWatch log resource policy.
Example Usage
Elasticsearch Log Publishing
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var elasticsearch_log_publishing_policyPolicyDocument = Output.Create(Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
{
Statements =
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
{
Actions =
{
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:PutLogEventsBatch",
},
Principals =
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalArgs
{
Identifiers =
{
"es.amazonaws.com",
},
Type = "Service",
},
},
Resources =
{
"arn:aws:logs:*",
},
},
},
}));
var elasticsearch_log_publishing_policyLogResourcePolicy = new Aws.CloudWatch.LogResourcePolicy("elasticsearch-log-publishing-policyLogResourcePolicy", new Aws.CloudWatch.LogResourcePolicyArgs
{
PolicyDocument = elasticsearch_log_publishing_policyPolicyDocument.Apply(elasticsearch_log_publishing_policyPolicyDocument => elasticsearch_log_publishing_policyPolicyDocument.Json),
PolicyName = "elasticsearch-log-publishing-policy",
});
}
}
Route53 Query Logging
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var route53_query_logging_policyPolicyDocument = Output.Create(Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
{
Statements =
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
{
Actions =
{
"logs:CreateLogStream",
"logs:PutLogEvents",
},
Principals =
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalArgs
{
Identifiers =
{
"route53.amazonaws.com",
},
Type = "Service",
},
},
Resources =
{
"arn:aws:logs:*:*:log-group:/aws/route53/*",
},
},
},
}));
var route53_query_logging_policyLogResourcePolicy = new Aws.CloudWatch.LogResourcePolicy("route53-query-logging-policyLogResourcePolicy", new Aws.CloudWatch.LogResourcePolicyArgs
{
PolicyDocument = route53_query_logging_policyPolicyDocument.Apply(route53_query_logging_policyPolicyDocument => route53_query_logging_policyPolicyDocument.Json),
PolicyName = "route53-query-logging-policy",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.CloudWatch
Assembly: Pulumi.Aws.dll
Syntax
public class LogResourcePolicy : CustomResource
Constructors
View SourceLogResourcePolicy(String, LogResourcePolicyArgs, CustomResourceOptions)
Create a LogResourcePolicy resource with the given unique name, arguments, and options.
Declaration
public LogResourcePolicy(string name, LogResourcePolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| LogResourcePolicyArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourcePolicyDocument
Details of the resource policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. Maximum length of 5120 characters.
Declaration
public Output<string> PolicyDocument { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PolicyName
Name of the resource policy.
Declaration
public Output<string> PolicyName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, LogResourcePolicyState, CustomResourceOptions)
Get an existing LogResourcePolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static LogResourcePolicy Get(string name, Input<string> id, LogResourcePolicyState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| LogResourcePolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| LogResourcePolicy |