1. Packages
  2. Ionoscloud
  3. API Docs
  4. cdn
  5. getDistribution
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

ionoscloud.cdn.getDistribution

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

    The Distribution data source can be used to search for and return an existing Distributions. You can provide a string for the domain parameter which will be compared with provisioned Distributions. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search and make sure that your resources have unique domains.

    Example Usage

    By Id

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.cdn.getDistribution({
        id: "distr_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.cdn.get_distribution(id="distr_id")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/cdn"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cdn.LookupDistribution(ctx, &cdn.LookupDistributionArgs{
    			Id: pulumi.StringRef("distr_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Cdn.GetDistribution.Invoke(new()
        {
            Id = "distr_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.cdn.CdnFunctions;
    import com.pulumi.ionoscloud.cdn.inputs.GetDistributionArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 example = CdnFunctions.getDistribution(GetDistributionArgs.builder()
                .id("distr_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:cdn:getDistribution
          arguments:
            id: distr_id
    

    By Domain

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.cdn.getDistribution({
        domain: "example.com",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.cdn.get_distribution(domain="example.com")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/cdn"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cdn.LookupDistribution(ctx, &cdn.LookupDistributionArgs{
    			Domain: pulumi.StringRef("example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Cdn.GetDistribution.Invoke(new()
        {
            Domain = "example.com",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.cdn.CdnFunctions;
    import com.pulumi.ionoscloud.cdn.inputs.GetDistributionArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 example = CdnFunctions.getDistribution(GetDistributionArgs.builder()
                .domain("example.com")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:cdn:getDistribution
          arguments:
            domain: example.com
    

    By Domain with Partial Match

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.cdn.getDistribution({
        domain: "example",
        partialMatch: true,
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.cdn.get_distribution(domain="example",
        partial_match=True)
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/cdn"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cdn.LookupDistribution(ctx, &cdn.LookupDistributionArgs{
    			Domain:       pulumi.StringRef("example"),
    			PartialMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Cdn.GetDistribution.Invoke(new()
        {
            Domain = "example",
            PartialMatch = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.cdn.CdnFunctions;
    import com.pulumi.ionoscloud.cdn.inputs.GetDistributionArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 example = CdnFunctions.getDistribution(GetDistributionArgs.builder()
                .domain("example")
                .partialMatch(true)
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:cdn:getDistribution
          arguments:
            domain: example
            partialMatch: true
    

    Using getDistribution

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getDistribution(args: GetDistributionArgs, opts?: InvokeOptions): Promise<GetDistributionResult>
    function getDistributionOutput(args: GetDistributionOutputArgs, opts?: InvokeOptions): Output<GetDistributionResult>
    def get_distribution(domain: Optional[str] = None,
                         id: Optional[str] = None,
                         partial_match: Optional[bool] = None,
                         opts: Optional[InvokeOptions] = None) -> GetDistributionResult
    def get_distribution_output(domain: Optional[pulumi.Input[str]] = None,
                         id: Optional[pulumi.Input[str]] = None,
                         partial_match: Optional[pulumi.Input[bool]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetDistributionResult]
    func LookupDistribution(ctx *Context, args *LookupDistributionArgs, opts ...InvokeOption) (*LookupDistributionResult, error)
    func LookupDistributionOutput(ctx *Context, args *LookupDistributionOutputArgs, opts ...InvokeOption) LookupDistributionResultOutput

    > Note: This function is named LookupDistribution in the Go SDK.

    public static class GetDistribution 
    {
        public static Task<GetDistributionResult> InvokeAsync(GetDistributionArgs args, InvokeOptions? opts = null)
        public static Output<GetDistributionResult> Invoke(GetDistributionInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDistributionResult> getDistribution(GetDistributionArgs args, InvokeOptions options)
    public static Output<GetDistributionResult> getDistribution(GetDistributionArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:cdn/getDistribution:getDistribution
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Domain string
    Domain of an existing distribution that you want to search for. Search by domain is case-insensitive. The whole resource domain is required if partial_match parameter is not set to true.
    Id string
    ID of the distribution you want to search for.
    PartialMatch bool

    Whether partial matching is allowed or not when using domain argument. Default value is false.

    Either domain or id must be provided. If none, or both of domain and id are provided, the datasource will return an error.

    Domain string
    Domain of an existing distribution that you want to search for. Search by domain is case-insensitive. The whole resource domain is required if partial_match parameter is not set to true.
    Id string
    ID of the distribution you want to search for.
    PartialMatch bool

    Whether partial matching is allowed or not when using domain argument. Default value is false.

    Either domain or id must be provided. If none, or both of domain and id are provided, the datasource will return an error.

    domain String
    Domain of an existing distribution that you want to search for. Search by domain is case-insensitive. The whole resource domain is required if partial_match parameter is not set to true.
    id String
    ID of the distribution you want to search for.
    partialMatch Boolean

    Whether partial matching is allowed or not when using domain argument. Default value is false.

    Either domain or id must be provided. If none, or both of domain and id are provided, the datasource will return an error.

    domain string
    Domain of an existing distribution that you want to search for. Search by domain is case-insensitive. The whole resource domain is required if partial_match parameter is not set to true.
    id string
    ID of the distribution you want to search for.
    partialMatch boolean

    Whether partial matching is allowed or not when using domain argument. Default value is false.

    Either domain or id must be provided. If none, or both of domain and id are provided, the datasource will return an error.

    domain str
    Domain of an existing distribution that you want to search for. Search by domain is case-insensitive. The whole resource domain is required if partial_match parameter is not set to true.
    id str
    ID of the distribution you want to search for.
    partial_match bool

    Whether partial matching is allowed or not when using domain argument. Default value is false.

    Either domain or id must be provided. If none, or both of domain and id are provided, the datasource will return an error.

    domain String
    Domain of an existing distribution that you want to search for. Search by domain is case-insensitive. The whole resource domain is required if partial_match parameter is not set to true.
    id String
    ID of the distribution you want to search for.
    partialMatch Boolean

    Whether partial matching is allowed or not when using domain argument. Default value is false.

    Either domain or id must be provided. If none, or both of domain and id are provided, the datasource will return an error.

    getDistribution Result

    The following output properties are available:

    CertificateId string
    The ID of the certificate to use for the distribution. You can create certificates with the certificate resource.
    Id string
    PublicEndpointV4 string
    IP of the distribution, it has to be included on the domain DNS Zone as A record.
    PublicEndpointV6 string
    IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
    ResourceUrn string
    Unique resource identifier.
    RoutingRules List<Ionoscloud.GetDistributionRoutingRule>
    The routing rules for the distribution.
    Domain string
    The domain of the distribution.
    PartialMatch bool
    CertificateId string
    The ID of the certificate to use for the distribution. You can create certificates with the certificate resource.
    Id string
    PublicEndpointV4 string
    IP of the distribution, it has to be included on the domain DNS Zone as A record.
    PublicEndpointV6 string
    IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
    ResourceUrn string
    Unique resource identifier.
    RoutingRules []GetDistributionRoutingRule
    The routing rules for the distribution.
    Domain string
    The domain of the distribution.
    PartialMatch bool
    certificateId String
    The ID of the certificate to use for the distribution. You can create certificates with the certificate resource.
    id String
    publicEndpointV4 String
    IP of the distribution, it has to be included on the domain DNS Zone as A record.
    publicEndpointV6 String
    IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
    resourceUrn String
    Unique resource identifier.
    routingRules List<GetDistributionRoutingRule>
    The routing rules for the distribution.
    domain String
    The domain of the distribution.
    partialMatch Boolean
    certificateId string
    The ID of the certificate to use for the distribution. You can create certificates with the certificate resource.
    id string
    publicEndpointV4 string
    IP of the distribution, it has to be included on the domain DNS Zone as A record.
    publicEndpointV6 string
    IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
    resourceUrn string
    Unique resource identifier.
    routingRules GetDistributionRoutingRule[]
    The routing rules for the distribution.
    domain string
    The domain of the distribution.
    partialMatch boolean
    certificate_id str
    The ID of the certificate to use for the distribution. You can create certificates with the certificate resource.
    id str
    public_endpoint_v4 str
    IP of the distribution, it has to be included on the domain DNS Zone as A record.
    public_endpoint_v6 str
    IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
    resource_urn str
    Unique resource identifier.
    routing_rules Sequence[GetDistributionRoutingRule]
    The routing rules for the distribution.
    domain str
    The domain of the distribution.
    partial_match bool
    certificateId String
    The ID of the certificate to use for the distribution. You can create certificates with the certificate resource.
    id String
    publicEndpointV4 String
    IP of the distribution, it has to be included on the domain DNS Zone as A record.
    publicEndpointV6 String
    IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
    resourceUrn String
    Unique resource identifier.
    routingRules List<Property Map>
    The routing rules for the distribution.
    domain String
    The domain of the distribution.
    partialMatch Boolean

    Supporting Types

    GetDistributionRoutingRule

    Prefix string
    The prefix of the routing rule.
    Scheme string
    The scheme of the routing rule.
    Upstreams List<Ionoscloud.GetDistributionRoutingRuleUpstream>
    A map of properties for the rule
    Prefix string
    The prefix of the routing rule.
    Scheme string
    The scheme of the routing rule.
    Upstreams []GetDistributionRoutingRuleUpstream
    A map of properties for the rule
    prefix String
    The prefix of the routing rule.
    scheme String
    The scheme of the routing rule.
    upstreams List<GetDistributionRoutingRuleUpstream>
    A map of properties for the rule
    prefix string
    The prefix of the routing rule.
    scheme string
    The scheme of the routing rule.
    upstreams GetDistributionRoutingRuleUpstream[]
    A map of properties for the rule
    prefix str
    The prefix of the routing rule.
    scheme str
    The scheme of the routing rule.
    upstreams Sequence[GetDistributionRoutingRuleUpstream]
    A map of properties for the rule
    prefix String
    The prefix of the routing rule.
    scheme String
    The scheme of the routing rule.
    upstreams List<Property Map>
    A map of properties for the rule

    GetDistributionRoutingRuleUpstream

    Caching bool
    Enable or disable caching. If enabled, the CDN will cache the responses from the upstream host. Subsequent requests for the same resource will be served from the cache.
    GeoRestrictions List<Ionoscloud.GetDistributionRoutingRuleUpstreamGeoRestriction>
    A map of geo_restrictions
    Host string
    The upstream host that handles the requests if not already cached. This host will be protected by the WAF if the option is enabled.
    RateLimitClass string
    Rate limit class that will be applied to limit the number of incoming requests per IP.
    SniMode string
    The SNI (Server Name Indication) mode of the upstream. It supports two modes: 1) distribution: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured domain of the CDN distribution; 2) origin: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured upstream/origin hostname.
    Waf bool
    Enable or disable WAF to protect the upstream host.
    Caching bool
    Enable or disable caching. If enabled, the CDN will cache the responses from the upstream host. Subsequent requests for the same resource will be served from the cache.
    GeoRestrictions []GetDistributionRoutingRuleUpstreamGeoRestriction
    A map of geo_restrictions
    Host string
    The upstream host that handles the requests if not already cached. This host will be protected by the WAF if the option is enabled.
    RateLimitClass string
    Rate limit class that will be applied to limit the number of incoming requests per IP.
    SniMode string
    The SNI (Server Name Indication) mode of the upstream. It supports two modes: 1) distribution: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured domain of the CDN distribution; 2) origin: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured upstream/origin hostname.
    Waf bool
    Enable or disable WAF to protect the upstream host.
    caching Boolean
    Enable or disable caching. If enabled, the CDN will cache the responses from the upstream host. Subsequent requests for the same resource will be served from the cache.
    geoRestrictions List<GetDistributionRoutingRuleUpstreamGeoRestriction>
    A map of geo_restrictions
    host String
    The upstream host that handles the requests if not already cached. This host will be protected by the WAF if the option is enabled.
    rateLimitClass String
    Rate limit class that will be applied to limit the number of incoming requests per IP.
    sniMode String
    The SNI (Server Name Indication) mode of the upstream. It supports two modes: 1) distribution: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured domain of the CDN distribution; 2) origin: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured upstream/origin hostname.
    waf Boolean
    Enable or disable WAF to protect the upstream host.
    caching boolean
    Enable or disable caching. If enabled, the CDN will cache the responses from the upstream host. Subsequent requests for the same resource will be served from the cache.
    geoRestrictions GetDistributionRoutingRuleUpstreamGeoRestriction[]
    A map of geo_restrictions
    host string
    The upstream host that handles the requests if not already cached. This host will be protected by the WAF if the option is enabled.
    rateLimitClass string
    Rate limit class that will be applied to limit the number of incoming requests per IP.
    sniMode string
    The SNI (Server Name Indication) mode of the upstream. It supports two modes: 1) distribution: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured domain of the CDN distribution; 2) origin: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured upstream/origin hostname.
    waf boolean
    Enable or disable WAF to protect the upstream host.
    caching bool
    Enable or disable caching. If enabled, the CDN will cache the responses from the upstream host. Subsequent requests for the same resource will be served from the cache.
    geo_restrictions Sequence[GetDistributionRoutingRuleUpstreamGeoRestriction]
    A map of geo_restrictions
    host str
    The upstream host that handles the requests if not already cached. This host will be protected by the WAF if the option is enabled.
    rate_limit_class str
    Rate limit class that will be applied to limit the number of incoming requests per IP.
    sni_mode str
    The SNI (Server Name Indication) mode of the upstream. It supports two modes: 1) distribution: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured domain of the CDN distribution; 2) origin: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured upstream/origin hostname.
    waf bool
    Enable or disable WAF to protect the upstream host.
    caching Boolean
    Enable or disable caching. If enabled, the CDN will cache the responses from the upstream host. Subsequent requests for the same resource will be served from the cache.
    geoRestrictions List<Property Map>
    A map of geo_restrictions
    host String
    The upstream host that handles the requests if not already cached. This host will be protected by the WAF if the option is enabled.
    rateLimitClass String
    Rate limit class that will be applied to limit the number of incoming requests per IP.
    sniMode String
    The SNI (Server Name Indication) mode of the upstream. It supports two modes: 1) distribution: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured domain of the CDN distribution; 2) origin: for outgoing connections to the upstream host, the CDN requires the upstream host to present a valid certificate that matches the configured upstream/origin hostname.
    waf Boolean
    Enable or disable WAF to protect the upstream host.

    GetDistributionRoutingRuleUpstreamGeoRestriction

    AllowLists List<string>
    List of allowed countries
    BlockLists List<string>
    List of blocked countries
    AllowLists []string
    List of allowed countries
    BlockLists []string
    List of blocked countries
    allowLists List<String>
    List of allowed countries
    blockLists List<String>
    List of blocked countries
    allowLists string[]
    List of allowed countries
    blockLists string[]
    List of blocked countries
    allow_lists Sequence[str]
    List of allowed countries
    block_lists Sequence[str]
    List of blocked countries
    allowLists List<String>
    List of allowed countries
    blockLists List<String>
    List of blocked countries

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud