1. Packages
  2. OVH
  3. API Docs
  4. CloudProjectDatabase
  5. IpRestriction
OVHCloud v0.50.0 published on Friday, Sep 20, 2024 by OVHcloud

ovh.CloudProjectDatabase.IpRestriction

Explore with Pulumi AI

ovh logo
OVHCloud v0.50.0 published on Friday, Sep 20, 2024 by OVHcloud

    Deprecated: Use ip_restriction field in cloud_project_database resource instead. Continuing to use the ovh.CloudProjectDatabase.IpRestriction resource to add an IP restriction to a cloud_project_database resource will cause the cloud_project_database resource to be updated on every apply

    Apply IP restrictions to an OVHcloud Managed Database cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    import * as ovh from "@pulumi/ovh";
    
    const db = ovh.CloudProjectDatabase.getDatabase({
        serviceName: "XXXX",
        engine: "YYYY",
        id: "ZZZZ",
    });
    const iprestriction = new ovh.cloudprojectdatabase.IpRestriction("iprestriction", {
        serviceName: db.then(db => db.serviceName),
        engine: db.then(db => db.engine),
        clusterId: db.then(db => db.id),
        ip: "178.97.6.0/24",
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    db = ovh.CloudProjectDatabase.get_database(service_name="XXXX",
        engine="YYYY",
        id="ZZZZ")
    iprestriction = ovh.cloud_project_database.IpRestriction("iprestriction",
        service_name=db.service_name,
        engine=db.engine,
        cluster_id=db.id,
        ip="178.97.6.0/24")
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/CloudProjectDatabase"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		db, err := CloudProjectDatabase.GetDatabase(ctx, &cloudprojectdatabase.GetDatabaseArgs{
    			ServiceName: "XXXX",
    			Engine:      "YYYY",
    			Id:          "ZZZZ",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = CloudProjectDatabase.NewIpRestriction(ctx, "iprestriction", &CloudProjectDatabase.IpRestrictionArgs{
    			ServiceName: pulumi.String(db.ServiceName),
    			Engine:      pulumi.String(db.Engine),
    			ClusterId:   pulumi.String(db.Id),
    			Ip:          pulumi.String("178.97.6.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var db = Ovh.CloudProjectDatabase.GetDatabase.Invoke(new()
        {
            ServiceName = "XXXX",
            Engine = "YYYY",
            Id = "ZZZZ",
        });
    
        var iprestriction = new Ovh.CloudProjectDatabase.IpRestriction("iprestriction", new()
        {
            ServiceName = db.Apply(getDatabaseResult => getDatabaseResult.ServiceName),
            Engine = db.Apply(getDatabaseResult => getDatabaseResult.Engine),
            ClusterId = db.Apply(getDatabaseResult => getDatabaseResult.Id),
            Ip = "178.97.6.0/24",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.CloudProjectDatabase.CloudProjectDatabaseFunctions;
    import com.pulumi.ovh.CloudProjectDatabase.inputs.GetDatabaseArgs;
    import com.pulumi.ovh.CloudProjectDatabase.IpRestriction;
    import com.pulumi.ovh.CloudProjectDatabase.IpRestrictionArgs;
    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 db = CloudProjectDatabaseFunctions.getDatabase(GetDatabaseArgs.builder()
                .serviceName("XXXX")
                .engine("YYYY")
                .id("ZZZZ")
                .build());
    
            var iprestriction = new IpRestriction("iprestriction", IpRestrictionArgs.builder()
                .serviceName(db.applyValue(getDatabaseResult -> getDatabaseResult.serviceName()))
                .engine(db.applyValue(getDatabaseResult -> getDatabaseResult.engine()))
                .clusterId(db.applyValue(getDatabaseResult -> getDatabaseResult.id()))
                .ip("178.97.6.0/24")
                .build());
    
        }
    }
    
    resources:
      iprestriction:
        type: ovh:CloudProjectDatabase:IpRestriction
        properties:
          serviceName: ${db.serviceName}
          engine: ${db.engine}
          clusterId: ${db.id}
          ip: 178.97.6.0/24
    variables:
      db:
        fn::invoke:
          Function: ovh:CloudProjectDatabase:getDatabase
          Arguments:
            serviceName: XXXX
            engine: YYYY
            id: ZZZZ
    

    Create IpRestriction Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new IpRestriction(name: string, args: IpRestrictionArgs, opts?: CustomResourceOptions);
    @overload
    def IpRestriction(resource_name: str,
                      args: IpRestrictionArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def IpRestriction(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      cluster_id: Optional[str] = None,
                      engine: Optional[str] = None,
                      ip: Optional[str] = None,
                      service_name: Optional[str] = None,
                      description: Optional[str] = None)
    func NewIpRestriction(ctx *Context, name string, args IpRestrictionArgs, opts ...ResourceOption) (*IpRestriction, error)
    public IpRestriction(string name, IpRestrictionArgs args, CustomResourceOptions? opts = null)
    public IpRestriction(String name, IpRestrictionArgs args)
    public IpRestriction(String name, IpRestrictionArgs args, CustomResourceOptions options)
    
    type: ovh:CloudProjectDatabase:IpRestriction
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args IpRestrictionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args IpRestrictionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args IpRestrictionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IpRestrictionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IpRestrictionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var ipRestrictionResource = new Ovh.CloudProjectDatabase.IpRestriction("ipRestrictionResource", new()
    {
        ClusterId = "string",
        Engine = "string",
        Ip = "string",
        ServiceName = "string",
        Description = "string",
    });
    
    example, err := CloudProjectDatabase.NewIpRestriction(ctx, "ipRestrictionResource", &CloudProjectDatabase.IpRestrictionArgs{
    	ClusterId:   pulumi.String("string"),
    	Engine:      pulumi.String("string"),
    	Ip:          pulumi.String("string"),
    	ServiceName: pulumi.String("string"),
    	Description: pulumi.String("string"),
    })
    
    var ipRestrictionResource = new IpRestriction("ipRestrictionResource", IpRestrictionArgs.builder()
        .clusterId("string")
        .engine("string")
        .ip("string")
        .serviceName("string")
        .description("string")
        .build());
    
    ip_restriction_resource = ovh.cloud_project_database.IpRestriction("ipRestrictionResource",
        cluster_id="string",
        engine="string",
        ip="string",
        service_name="string",
        description="string")
    
    const ipRestrictionResource = new ovh.cloudprojectdatabase.IpRestriction("ipRestrictionResource", {
        clusterId: "string",
        engine: "string",
        ip: "string",
        serviceName: "string",
        description: "string",
    });
    
    type: ovh:CloudProjectDatabase:IpRestriction
    properties:
        clusterId: string
        description: string
        engine: string
        ip: string
        serviceName: string
    

    IpRestriction Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The IpRestriction resource accepts the following input properties:

    ClusterId string
    Cluster ID.
    Engine string
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    Ip string
    Authorized IP.
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    Description string
    Description of the IP restriction.
    ClusterId string
    Cluster ID.
    Engine string
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    Ip string
    Authorized IP.
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    Description string
    Description of the IP restriction.
    clusterId String
    Cluster ID.
    engine String
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip String
    Authorized IP.
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    description String
    Description of the IP restriction.
    clusterId string
    Cluster ID.
    engine string
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip string
    Authorized IP.
    serviceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    description string
    Description of the IP restriction.
    cluster_id str
    Cluster ID.
    engine str
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip str
    Authorized IP.
    service_name str
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    description str
    Description of the IP restriction.
    clusterId String
    Cluster ID.
    engine String
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip String
    Authorized IP.
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    description String
    Description of the IP restriction.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the IpRestriction resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    Current status of the IP restriction.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    Current status of the IP restriction.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    Current status of the IP restriction.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    Current status of the IP restriction.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    Current status of the IP restriction.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    Current status of the IP restriction.

    Look up Existing IpRestriction Resource

    Get an existing IpRestriction resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: IpRestrictionState, opts?: CustomResourceOptions): IpRestriction
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            description: Optional[str] = None,
            engine: Optional[str] = None,
            ip: Optional[str] = None,
            service_name: Optional[str] = None,
            status: Optional[str] = None) -> IpRestriction
    func GetIpRestriction(ctx *Context, name string, id IDInput, state *IpRestrictionState, opts ...ResourceOption) (*IpRestriction, error)
    public static IpRestriction Get(string name, Input<string> id, IpRestrictionState? state, CustomResourceOptions? opts = null)
    public static IpRestriction get(String name, Output<String> id, IpRestrictionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ClusterId string
    Cluster ID.
    Description string
    Description of the IP restriction.
    Engine string
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    Ip string
    Authorized IP.
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    Status string
    Current status of the IP restriction.
    ClusterId string
    Cluster ID.
    Description string
    Description of the IP restriction.
    Engine string
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    Ip string
    Authorized IP.
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    Status string
    Current status of the IP restriction.
    clusterId String
    Cluster ID.
    description String
    Description of the IP restriction.
    engine String
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip String
    Authorized IP.
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    status String
    Current status of the IP restriction.
    clusterId string
    Cluster ID.
    description string
    Description of the IP restriction.
    engine string
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip string
    Authorized IP.
    serviceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    status string
    Current status of the IP restriction.
    cluster_id str
    Cluster ID.
    description str
    Description of the IP restriction.
    engine str
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip str
    Authorized IP.
    service_name str
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    status str
    Current status of the IP restriction.
    clusterId String
    Cluster ID.
    description String
    Description of the IP restriction.
    engine String
    The engine of the database cluster you want to add an IP restriction. To get a full list of available engine visit. public documentation.
    ip String
    Authorized IP.
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    status String
    Current status of the IP restriction.

    Import

    OVHcloud Managed database cluster IP restrictions can be imported using the service_name, engine, cluster_id and the ip, separated by “/” E.g.,

    bash

    $ pulumi import ovh:CloudProjectDatabase/ipRestriction:IpRestriction my_ip_restriction service_name/engine/cluster_id/178.97.6.0/24
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    OVHCloud v0.50.0 published on Friday, Sep 20, 2024 by OVHcloud