Package com.pulumi.aws.route53
Class QueryLog
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.route53.QueryLog
-
public class QueryLog extends com.pulumi.resources.CustomResourceProvides a Route53 query logging configuration resource. > **NOTE:** There are restrictions on the configuration of query logging. Notably, the CloudWatch log group must be in the `us-east-1` region, a permissive CloudWatch log resource policy must be in place, and the Route53 hosted zone must be public. See [Configuring Logging for DNS Queries](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html?console_help=true#query-logs-configuring) for additional details. ## Example Usage
## Import Using `pulumi import`, import Route53 query logging configurations using their ID. For example: ```sh $ pulumi import aws:route53/queryLog:QueryLog example_com xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.route53.Zone; import com.pulumi.aws.route53.ZoneArgs; import com.pulumi.aws.cloudwatch.LogGroup; import com.pulumi.aws.cloudwatch.LogGroupArgs; import com.pulumi.aws.iam.IamFunctions; import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs; import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs; import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs; import com.pulumi.aws.cloudwatch.LogResourcePolicy; import com.pulumi.aws.cloudwatch.LogResourcePolicyArgs; import com.pulumi.aws.route53.QueryLog; import com.pulumi.aws.route53.QueryLogArgs; import com.pulumi.resources.CustomResourceOptions; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { // Example Route53 zone with query logging var exampleCom = new Zone("exampleCom", ZoneArgs.builder() .name("example.com") .build()); var awsRoute53ExampleCom = new LogGroup("awsRoute53ExampleCom", LogGroupArgs.builder() .name(exampleCom.name().applyValue(_name -> String.format("/aws/route53/%s", _name))) .retentionInDays(30) .build()); // Example CloudWatch log resource policy to allow Route53 to write logs // to any log group under /aws/route53/* final var route53-query-logging-policy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder() .statements(GetPolicyDocumentStatementArgs.builder() .principals(GetPolicyDocumentStatementPrincipalArgs.builder() .identifiers("route53.amazonaws.com") .type("Service") .build()) .actions( "logs:CreateLogStream", "logs:PutLogEvents") .resources("arn:aws:logs:*:*:log-group:/aws/route53/*") .build()) .build()); var route53_query_logging_policyLogResourcePolicy = new LogResourcePolicy("route53-query-logging-policyLogResourcePolicy", LogResourcePolicyArgs.builder() .policyDocument(route53_query_logging_policy.json()) .policyName("route53-query-logging-policy") .build()); var exampleComQueryLog = new QueryLog("exampleComQueryLog", QueryLogArgs.builder() .cloudwatchLogGroupArn(awsRoute53ExampleCom.arn()) .zoneId(exampleCom.zoneId()) .build(), CustomResourceOptions.builder() .dependsOn(route53_query_logging_policyLogResourcePolicy) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description QueryLog(java.lang.String name)QueryLog(java.lang.String name, QueryLogArgs args)QueryLog(java.lang.String name, QueryLogArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.lang.String>cloudwatchLogGroupArn()static QueryLogget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, QueryLogState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>zoneId()
-
-
-
Constructor Detail
-
QueryLog
public QueryLog(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
QueryLog
public QueryLog(java.lang.String name, QueryLogArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
QueryLog
public QueryLog(java.lang.String name, QueryLogArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the Query Logging Config.
-
cloudwatchLogGroupArn
public com.pulumi.core.Output<java.lang.String> cloudwatchLogGroupArn()
- Returns:
- CloudWatch log group ARN to send query logs.
-
zoneId
public com.pulumi.core.Output<java.lang.String> zoneId()
- Returns:
- Route53 hosted zone ID to enable query logs.
-
get
public static QueryLog get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable QueryLogState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-