Package com.pulumi.aws.apprunner
Class CustomDomainAssociation
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.apprunner.CustomDomainAssociation
-
public class CustomDomainAssociation extends com.pulumi.resources.CustomResourceManages an App Runner Custom Domain association. > **NOTE:** After creation, you must use the information in the `certificateValidationRecords` attribute to add CNAME records to your DNS. For each mapped domain name, add a mapping to the target App Runner subdomain (found in the `dnsTarget` attribute) and one or more certificate validation records. App Runner then performs DNS validation to verify that you own or control the domain name you associated. App Runner tracks domain validity in a certificate stored in AWS Certificate Manager (ACM). ## Example Usage The attribute `certificateValidationRecords` has a fixed count of records, 3 when `enableWwwSubdomain` is `true` (the default) or 2 otherwise. Due to a limitation in how the `forEach` and `count` meta-arguments are handled, they cannot directly use the value of `certificateValidationRecords` when creating a new `aws.apprunner.CustomDomainAssociation`, as the value is unknown. A workaround is shown below, using a fixed `count` based on the value of `enableWwwSubdomain`.
## Import Using `pulumi import`, import App Runner Custom Domain Associations using the `domainName` and `serviceArn` separated by a comma (`,`). For example: ```sh $ pulumi import aws:apprunner/customDomainAssociation:CustomDomainAssociation example example.com,arn:aws:apprunner:us-east-1:123456789012:service/example-app/8fe1e10304f84fd2b0df550fe98a71fa ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.apprunner.CustomDomainAssociation; import com.pulumi.aws.apprunner.CustomDomainAssociationArgs; import com.pulumi.aws.route53.Record; import com.pulumi.aws.route53.RecordArgs; 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) { var example = new CustomDomainAssociation("example", CustomDomainAssociationArgs.builder() .domainName("example.com") .serviceArn(exampleAwsApprunnerService.arn()) .build()); final var certificateValidationRecords = example.certificateValidationRecords(); for (var i = 0; i < example.enableWwwSubdomain().applyValue(_enableWwwSubdomain -> _enableWwwSubdomain ? 3 : 2); i++) { new Record("validation-" + i, RecordArgs.builder() .zoneId(exampleAwsRoute53Zone.zoneId()) .name(certificateValidationRecords.applyValue(_certificateValidationRecords -> _certificateValidationRecords[range.value()].name())) .type("CNAME") .ttl(300) .records(certificateValidationRecords.applyValue(_certificateValidationRecords -> _certificateValidationRecords[range.value()].value())) .build()); } } }
-
-
Constructor Summary
Constructors Constructor Description CustomDomainAssociation(java.lang.String name)CustomDomainAssociation(java.lang.String name, CustomDomainAssociationArgs args)CustomDomainAssociation(java.lang.String name, CustomDomainAssociationArgs 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.util.List<CustomDomainAssociationCertificateValidationRecord>>certificateValidationRecords()com.pulumi.core.Output<java.lang.String>dnsTarget()com.pulumi.core.Output<java.lang.String>domainName()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableWwwSubdomain()static CustomDomainAssociationget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, CustomDomainAssociationState 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>region()com.pulumi.core.Output<java.lang.String>serviceArn()com.pulumi.core.Output<java.lang.String>status()
-
-
-
Constructor Detail
-
CustomDomainAssociation
public CustomDomainAssociation(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
CustomDomainAssociation
public CustomDomainAssociation(java.lang.String name, CustomDomainAssociationArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
CustomDomainAssociation
public CustomDomainAssociation(java.lang.String name, CustomDomainAssociationArgs 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
-
certificateValidationRecords
public com.pulumi.core.Output<java.util.List<CustomDomainAssociationCertificateValidationRecord>> certificateValidationRecords()
- Returns:
- Set of certificate CNAME records used for this domain name. See `certificateValidationRecords` Block below for more details.
-
dnsTarget
public com.pulumi.core.Output<java.lang.String> dnsTarget()
- Returns:
- App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name.
-
domainName
public com.pulumi.core.Output<java.lang.String> domainName()
- Returns:
- Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`. Must not end with a trailing period. `enableWwwSubdomain` must be set to `false` when using a wildcard domain.
-
enableWwwSubdomain
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableWwwSubdomain()
- Returns:
- Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`. Must be set to `false` when `domainName` is a wildcard domain.
-
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.
-
serviceArn
public com.pulumi.core.Output<java.lang.String> serviceArn()
- Returns:
- ARN of the App Runner service.
-
status
public com.pulumi.core.Output<java.lang.String> status()
- Returns:
- Current state of the certificate `CNAME` record validation. It should change to `SUCCESS` after App Runner completes validation with your DNS.
-
get
public static CustomDomainAssociation get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable CustomDomainAssociationState 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.
-
-