Package com.pulumi.aws.rds
Class Proxy
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.rds.Proxy
-
public class Proxy extends com.pulumi.resources.CustomResourceProvides an RDS DB proxy resource. For additional information, see the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html). > **Note:** Not all Availability Zones (AZs) support DB proxies. Specifying `vpcSubnetIds` for AZs that do not support proxies will not trigger an error as long as at least one `vpcSubnetId` is valid. However, this will cause Terraform to continuously detect differences between the configuration and the actual infrastructure. Refer to the Unsupported Availability Zones section below for potential workarounds. ## Example Usage ### Basic Usage
### Unsupported Availability Zones Terraform may report constant differences if you use `vpcSubnetIds` that correspond to Availability Zones (AZs) that do not support a DB proxy. While this typically does not result in an error, AWS only returns `vpcSubnetIds` for AZs that support DB proxies. As a result, Terraform detects a mismatch between your configuration and the actual infrastructure, leading it to report that changes are required. Below are some ways to avoid this issue. One solution is to exclude AZs that do not support DB proxies by using the `aws.getAvailabilityZones` data source. The example below demonstrates how to configure this for the `us-east-1` region, excluding the `use1-az3` AZ. (Keep in mind that AZ names can vary between accounts, while AZ IDs remain consistent.) If the `us-east-1` region has six AZs in total and you aim to configure the maximum number of subnets, you would exclude one AZ and configure five subnets:package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.rds.Proxy; import com.pulumi.aws.rds.ProxyArgs; import com.pulumi.aws.rds.inputs.ProxyAuthArgs; 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) { var example = new Proxy("example", ProxyArgs.builder() .auths(ProxyAuthArgs.builder() .authScheme("SECRETS") .description("example") .iamAuth("DISABLED") .secretArn(exampleAwsSecretsmanagerSecret.arn()) .build()) .name("example") .debugLogging(false) .engineFamily("MYSQL") .idleClientTimeout(1800) .requireTls(true) .roleArn(exampleAwsIamRole.arn()) .vpcSecurityGroupIds(exampleAwsSecurityGroup.id()) .vpcSubnetIds(exampleAwsSubnet.id()) .tags(Map.ofEntries( Map.entry("Name", "example"), Map.entry("Key", "value") )) .build()); } }
Another approach is to use the `lifecycle` `ignoreChanges` meta-argument. With this method, Terraform will stop detecting differences for the `vpcSubnetIds` argument. However, note that this approach disables Terraform's ability to track and manage updates to `vpcSubnetIds`, so use it carefully to avoid unintended drift between your configuration and the actual infrastructure.package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.AwsFunctions; import com.pulumi.aws.inputs.GetAvailabilityZonesArgs; import com.pulumi.aws.inputs.GetAvailabilityZonesFilterArgs; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.Subnet; import com.pulumi.aws.ec2.SubnetArgs; import com.pulumi.std.StdFunctions; import com.pulumi.std.inputs.CidrsubnetArgs; import com.pulumi.aws.rds.Proxy; import com.pulumi.aws.rds.ProxyArgs; import com.pulumi.codegen.internal.KeyedValue; 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) { final var available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder() .filters(GetAvailabilityZonesFilterArgs.builder() .name("opt-in-status") .values("opt-in-not-required") .build()) .excludeZoneIds("use1-az3") .state("available") .build()); var example = new Vpc("example", VpcArgs.builder() .cidrBlock("10.0.0.0/16") .build()); for (var i = 0; i < 5; i++) { new Subnet("exampleSubnet-" + i, SubnetArgs.builder() .cidrBlock(StdFunctions.cidrsubnet(CidrsubnetArgs.builder() .input(example.cidrBlock()) .newbits(8) .netnum(range.value()) .build()).applyValue(_invoke -> _invoke.result())) .availabilityZone(available.names()[range.value()]) .vpcId(example.id()) .build()); } var exampleProxy = new Proxy("exampleProxy", ProxyArgs.builder() .name("example") .vpcSubnetIds(exampleSubnet.id()) .build()); } }
## Import Using `pulumi import`, import DB proxies using the `name`. For example: ```sh $ pulumi import aws:rds/proxy:Proxy example example ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.rds.Proxy; import com.pulumi.aws.rds.ProxyArgs; 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) { var example = new Proxy("example", ProxyArgs.builder() .name("example") .vpcSubnetIds(exampleAwsSubnet.id()) .build(), CustomResourceOptions.builder() .ignoreChanges("vpcSubnetIds") .build()); } }
-
-
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.util.Optional<java.util.List<ProxyAuth>>>auths()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>debugLogging()com.pulumi.core.Output<java.lang.String>defaultAuthScheme()com.pulumi.core.Output<java.lang.String>endpoint()com.pulumi.core.Output<java.lang.String>endpointNetworkType()com.pulumi.core.Output<java.lang.String>engineFamily()static Proxyget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ProxyState 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.Integer>idleClientTimeout()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>requireTls()com.pulumi.core.Output<java.lang.String>roleArn()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()com.pulumi.core.Output<java.lang.String>targetConnectionNetworkType()com.pulumi.core.Output<java.util.List<java.lang.String>>vpcSecurityGroupIds()com.pulumi.core.Output<java.util.List<java.lang.String>>vpcSubnetIds()
-
-
-
Constructor Detail
-
Proxy
public Proxy(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Proxy
public Proxy(java.lang.String name, ProxyArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Proxy
public Proxy(java.lang.String name, ProxyArgs 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 for the proxy.
-
auths
public com.pulumi.core.Output<java.util.Optional<java.util.List<ProxyAuth>>> auths()
- Returns:
- Configuration block(s) with authorization mechanisms to connect to the associated instances or clusters. Required when `defaultAuthScheme` is `NONE` or unspecified. See the `auth` block below.
-
debugLogging
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> debugLogging()
- Returns:
- Whether the proxy includes detailed information about SQL statements in its logs. This information helps you to debug issues involving SQL behavior or the performance and scalability of the proxy connections. The debug information includes the text of SQL statements that you submit through the proxy. Thus, only enable this setting when needed for debugging, and only when you have security measures in place to safeguard any sensitive information that appears in the logs.
-
defaultAuthScheme
public com.pulumi.core.Output<java.lang.String> defaultAuthScheme()
- Returns:
- Default authentication scheme that the proxy uses for client connections to the proxy and connections from the proxy to the underlying database. Valid values are `NONE` and `IAM_AUTH`. Defaults to `NONE`.
-
endpoint
public com.pulumi.core.Output<java.lang.String> endpoint()
- Returns:
- Endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
-
endpointNetworkType
public com.pulumi.core.Output<java.lang.String> endpointNetworkType()
- Returns:
- Network type of the DB proxy endpoint. Valid values are `IPV4`, `IPV6` and `DUAL`. Defaults to `IPV4`. If `IPV6` is specified, the subnets associated with the proxy must be IPv6-only, and `targetConnectionNetworkType` must be `IPV6`.
-
engineFamily
public com.pulumi.core.Output<java.lang.String> engineFamily()
- Returns:
- Kinds of databases that the proxy can connect to. This value determines which database network protocol the proxy recognizes when it interprets network traffic to and from the database. For Aurora MySQL, RDS for MariaDB, and RDS for MySQL databases, specify `MYSQL`. For Aurora PostgreSQL and RDS for PostgreSQL databases, specify `POSTGRESQL`. For RDS for Microsoft SQL Server, specify `SQLSERVER`. Valid values are `MYSQL`, `POSTGRESQL`, and `SQLSERVER`.
-
idleClientTimeout
public com.pulumi.core.Output<java.lang.Integer> idleClientTimeout()
- Returns:
- Number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Identifier for the proxy. This name must be unique for all proxies owned by your AWS account in the specified AWS Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
requireTls
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> requireTls()
- Returns:
- Whether TLS encryption is required for connections to the proxy. Enabling this setting enforces encrypted TLS connections to the proxy.
-
roleArn
public com.pulumi.core.Output<java.lang.String> roleArn()
- Returns:
- ARN of the IAM role that the proxy uses to access secrets in AWS Secrets Manager.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
targetConnectionNetworkType
public com.pulumi.core.Output<java.lang.String> targetConnectionNetworkType()
- Returns:
- Network type that the proxy uses to connect to the target database. Valid values are `IPV4` and `IPV6`. Defaults to `IPV4`.
-
vpcSecurityGroupIds
public com.pulumi.core.Output<java.util.List<java.lang.String>> vpcSecurityGroupIds()
- Returns:
- One or more VPC security group IDs to associate with the new proxy.
-
vpcSubnetIds
public com.pulumi.core.Output<java.util.List<java.lang.String>> vpcSubnetIds()
- Returns:
- One or more VPC subnet IDs to associate with the new proxy.
-
get
public static Proxy get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ProxyState 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.
-
-