1. Packages
  2. Scaleway
  3. API Docs
  4. getVpcPublicPatRule
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

scaleway.getVpcPublicPatRule

Explore with Pulumi AI

scaleway logo
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

    Gets information about a public gateway PAT rule. For further information please check the API documentation

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumi/scaleway";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const sg01 = new scaleway.InstanceSecurityGroup("sg01", {
        inboundDefaultPolicy: "drop",
        outboundDefaultPolicy: "accept",
        inboundRules: [{
            action: "accept",
            port: 22,
            protocol: "TCP",
        }],
    });
    const srv01 = new scaleway.InstanceServer("srv01", {
        type: "PLAY2-NANO",
        image: "ubuntu_jammy",
        securityGroupId: sg01.id,
    });
    const pn01 = new scaleway.VpcPrivateNetwork("pn01", {});
    const pnic01 = new scaleway.InstancePrivateNic("pnic01", {
        serverId: srv01.id,
        privateNetworkId: pn01.id,
    });
    const dhcp01 = new scaleway.VpcPublicGatewayDhcp("dhcp01", {subnet: "192.168.0.0/24"});
    const ip01 = new scaleway.VpcPublicGatewayIp("ip01", {});
    const pg01 = new scaleway.VpcPublicGateway("pg01", {
        type: "VPC-GW-S",
        ipId: ip01.id,
    });
    const gn01 = new scaleway.VpcGatewayNetwork("gn01", {
        gatewayId: pg01.id,
        privateNetworkId: pn01.id,
        dhcpId: dhcp01.id,
        cleanupDhcp: true,
        enableMasquerade: true,
    });
    const rsv01 = new scaleway.VpcPublicGatewayDhcpReservation("rsv01", {
        gatewayNetworkId: gn01.id,
        macAddress: pnic01.macAddress,
        ipAddress: "192.168.0.7",
    });
    const pat01 = new scaleway.VpcPublicGatewayPatRule("pat01", {
        gatewayId: pg01.id,
        privateIp: rsv01.ipAddress,
        privatePort: 22,
        publicPort: 2202,
        protocol: "tcp",
    });
    const main = scaleway.getVpcPublicPatRuleOutput({
        patRuleId: pat01.id,
    });
    
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway
    
    sg01 = scaleway.InstanceSecurityGroup("sg01",
        inbound_default_policy="drop",
        outbound_default_policy="accept",
        inbound_rules=[scaleway.InstanceSecurityGroupInboundRuleArgs(
            action="accept",
            port=22,
            protocol="TCP",
        )])
    srv01 = scaleway.InstanceServer("srv01",
        type="PLAY2-NANO",
        image="ubuntu_jammy",
        security_group_id=sg01.id)
    pn01 = scaleway.VpcPrivateNetwork("pn01")
    pnic01 = scaleway.InstancePrivateNic("pnic01",
        server_id=srv01.id,
        private_network_id=pn01.id)
    dhcp01 = scaleway.VpcPublicGatewayDhcp("dhcp01", subnet="192.168.0.0/24")
    ip01 = scaleway.VpcPublicGatewayIp("ip01")
    pg01 = scaleway.VpcPublicGateway("pg01",
        type="VPC-GW-S",
        ip_id=ip01.id)
    gn01 = scaleway.VpcGatewayNetwork("gn01",
        gateway_id=pg01.id,
        private_network_id=pn01.id,
        dhcp_id=dhcp01.id,
        cleanup_dhcp=True,
        enable_masquerade=True)
    rsv01 = scaleway.VpcPublicGatewayDhcpReservation("rsv01",
        gateway_network_id=gn01.id,
        mac_address=pnic01.mac_address,
        ip_address="192.168.0.7")
    pat01 = scaleway.VpcPublicGatewayPatRule("pat01",
        gateway_id=pg01.id,
        private_ip=rsv01.ip_address,
        private_port=22,
        public_port=2202,
        protocol="tcp")
    main = scaleway.get_vpc_public_pat_rule_output(pat_rule_id=pat01.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		sg01, err := scaleway.NewInstanceSecurityGroup(ctx, "sg01", &scaleway.InstanceSecurityGroupArgs{
    			InboundDefaultPolicy:  pulumi.String("drop"),
    			OutboundDefaultPolicy: pulumi.String("accept"),
    			InboundRules: scaleway.InstanceSecurityGroupInboundRuleArray{
    				&scaleway.InstanceSecurityGroupInboundRuleArgs{
    					Action:   pulumi.String("accept"),
    					Port:     pulumi.Int(22),
    					Protocol: pulumi.String("TCP"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		srv01, err := scaleway.NewInstanceServer(ctx, "srv01", &scaleway.InstanceServerArgs{
    			Type:            pulumi.String("PLAY2-NANO"),
    			Image:           pulumi.String("ubuntu_jammy"),
    			SecurityGroupId: sg01.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		pn01, err := scaleway.NewVpcPrivateNetwork(ctx, "pn01", nil)
    		if err != nil {
    			return err
    		}
    		pnic01, err := scaleway.NewInstancePrivateNic(ctx, "pnic01", &scaleway.InstancePrivateNicArgs{
    			ServerId:         srv01.ID(),
    			PrivateNetworkId: pn01.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		dhcp01, err := scaleway.NewVpcPublicGatewayDhcp(ctx, "dhcp01", &scaleway.VpcPublicGatewayDhcpArgs{
    			Subnet: pulumi.String("192.168.0.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		ip01, err := scaleway.NewVpcPublicGatewayIp(ctx, "ip01", nil)
    		if err != nil {
    			return err
    		}
    		pg01, err := scaleway.NewVpcPublicGateway(ctx, "pg01", &scaleway.VpcPublicGatewayArgs{
    			Type: pulumi.String("VPC-GW-S"),
    			IpId: ip01.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		gn01, err := scaleway.NewVpcGatewayNetwork(ctx, "gn01", &scaleway.VpcGatewayNetworkArgs{
    			GatewayId:        pg01.ID(),
    			PrivateNetworkId: pn01.ID(),
    			DhcpId:           dhcp01.ID(),
    			CleanupDhcp:      pulumi.Bool(true),
    			EnableMasquerade: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		rsv01, err := scaleway.NewVpcPublicGatewayDhcpReservation(ctx, "rsv01", &scaleway.VpcPublicGatewayDhcpReservationArgs{
    			GatewayNetworkId: gn01.ID(),
    			MacAddress:       pnic01.MacAddress,
    			IpAddress:        pulumi.String("192.168.0.7"),
    		})
    		if err != nil {
    			return err
    		}
    		pat01, err := scaleway.NewVpcPublicGatewayPatRule(ctx, "pat01", &scaleway.VpcPublicGatewayPatRuleArgs{
    			GatewayId:   pg01.ID(),
    			PrivateIp:   rsv01.IpAddress,
    			PrivatePort: pulumi.Int(22),
    			PublicPort:  pulumi.Int(2202),
    			Protocol:    pulumi.String("tcp"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = scaleway.GetVpcPublicPatRuleOutput(ctx, scaleway.GetVpcPublicPatRuleOutputArgs{
    			PatRuleId: pat01.ID(),
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var sg01 = new Scaleway.InstanceSecurityGroup("sg01", new()
        {
            InboundDefaultPolicy = "drop",
            OutboundDefaultPolicy = "accept",
            InboundRules = new[]
            {
                new Scaleway.Inputs.InstanceSecurityGroupInboundRuleArgs
                {
                    Action = "accept",
                    Port = 22,
                    Protocol = "TCP",
                },
            },
        });
    
        var srv01 = new Scaleway.InstanceServer("srv01", new()
        {
            Type = "PLAY2-NANO",
            Image = "ubuntu_jammy",
            SecurityGroupId = sg01.Id,
        });
    
        var pn01 = new Scaleway.VpcPrivateNetwork("pn01");
    
        var pnic01 = new Scaleway.InstancePrivateNic("pnic01", new()
        {
            ServerId = srv01.Id,
            PrivateNetworkId = pn01.Id,
        });
    
        var dhcp01 = new Scaleway.VpcPublicGatewayDhcp("dhcp01", new()
        {
            Subnet = "192.168.0.0/24",
        });
    
        var ip01 = new Scaleway.VpcPublicGatewayIp("ip01");
    
        var pg01 = new Scaleway.VpcPublicGateway("pg01", new()
        {
            Type = "VPC-GW-S",
            IpId = ip01.Id,
        });
    
        var gn01 = new Scaleway.VpcGatewayNetwork("gn01", new()
        {
            GatewayId = pg01.Id,
            PrivateNetworkId = pn01.Id,
            DhcpId = dhcp01.Id,
            CleanupDhcp = true,
            EnableMasquerade = true,
        });
    
        var rsv01 = new Scaleway.VpcPublicGatewayDhcpReservation("rsv01", new()
        {
            GatewayNetworkId = gn01.Id,
            MacAddress = pnic01.MacAddress,
            IpAddress = "192.168.0.7",
        });
    
        var pat01 = new Scaleway.VpcPublicGatewayPatRule("pat01", new()
        {
            GatewayId = pg01.Id,
            PrivateIp = rsv01.IpAddress,
            PrivatePort = 22,
            PublicPort = 2202,
            Protocol = "tcp",
        });
    
        var main = Scaleway.GetVpcPublicPatRule.Invoke(new()
        {
            PatRuleId = pat01.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.InstanceSecurityGroup;
    import com.pulumi.scaleway.InstanceSecurityGroupArgs;
    import com.pulumi.scaleway.inputs.InstanceSecurityGroupInboundRuleArgs;
    import com.pulumi.scaleway.InstanceServer;
    import com.pulumi.scaleway.InstanceServerArgs;
    import com.pulumi.scaleway.VpcPrivateNetwork;
    import com.pulumi.scaleway.InstancePrivateNic;
    import com.pulumi.scaleway.InstancePrivateNicArgs;
    import com.pulumi.scaleway.VpcPublicGatewayDhcp;
    import com.pulumi.scaleway.VpcPublicGatewayDhcpArgs;
    import com.pulumi.scaleway.VpcPublicGatewayIp;
    import com.pulumi.scaleway.VpcPublicGateway;
    import com.pulumi.scaleway.VpcPublicGatewayArgs;
    import com.pulumi.scaleway.VpcGatewayNetwork;
    import com.pulumi.scaleway.VpcGatewayNetworkArgs;
    import com.pulumi.scaleway.VpcPublicGatewayDhcpReservation;
    import com.pulumi.scaleway.VpcPublicGatewayDhcpReservationArgs;
    import com.pulumi.scaleway.VpcPublicGatewayPatRule;
    import com.pulumi.scaleway.VpcPublicGatewayPatRuleArgs;
    import com.pulumi.scaleway.ScalewayFunctions;
    import com.pulumi.scaleway.inputs.GetVpcPublicPatRuleArgs;
    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) {
            var sg01 = new InstanceSecurityGroup("sg01", InstanceSecurityGroupArgs.builder()        
                .inboundDefaultPolicy("drop")
                .outboundDefaultPolicy("accept")
                .inboundRules(InstanceSecurityGroupInboundRuleArgs.builder()
                    .action("accept")
                    .port(22)
                    .protocol("TCP")
                    .build())
                .build());
    
            var srv01 = new InstanceServer("srv01", InstanceServerArgs.builder()        
                .type("PLAY2-NANO")
                .image("ubuntu_jammy")
                .securityGroupId(sg01.id())
                .build());
    
            var pn01 = new VpcPrivateNetwork("pn01");
    
            var pnic01 = new InstancePrivateNic("pnic01", InstancePrivateNicArgs.builder()        
                .serverId(srv01.id())
                .privateNetworkId(pn01.id())
                .build());
    
            var dhcp01 = new VpcPublicGatewayDhcp("dhcp01", VpcPublicGatewayDhcpArgs.builder()        
                .subnet("192.168.0.0/24")
                .build());
    
            var ip01 = new VpcPublicGatewayIp("ip01");
    
            var pg01 = new VpcPublicGateway("pg01", VpcPublicGatewayArgs.builder()        
                .type("VPC-GW-S")
                .ipId(ip01.id())
                .build());
    
            var gn01 = new VpcGatewayNetwork("gn01", VpcGatewayNetworkArgs.builder()        
                .gatewayId(pg01.id())
                .privateNetworkId(pn01.id())
                .dhcpId(dhcp01.id())
                .cleanupDhcp(true)
                .enableMasquerade(true)
                .build());
    
            var rsv01 = new VpcPublicGatewayDhcpReservation("rsv01", VpcPublicGatewayDhcpReservationArgs.builder()        
                .gatewayNetworkId(gn01.id())
                .macAddress(pnic01.macAddress())
                .ipAddress("192.168.0.7")
                .build());
    
            var pat01 = new VpcPublicGatewayPatRule("pat01", VpcPublicGatewayPatRuleArgs.builder()        
                .gatewayId(pg01.id())
                .privateIp(rsv01.ipAddress())
                .privatePort(22)
                .publicPort(2202)
                .protocol("tcp")
                .build());
    
            final var main = ScalewayFunctions.getVpcPublicPatRule(GetVpcPublicPatRuleArgs.builder()
                .patRuleId(pat01.id())
                .build());
    
        }
    }
    
    resources:
      sg01:
        type: scaleway:InstanceSecurityGroup
        properties:
          inboundDefaultPolicy: drop
          outboundDefaultPolicy: accept
          inboundRules:
            - action: accept
              port: 22
              protocol: TCP
      srv01:
        type: scaleway:InstanceServer
        properties:
          type: PLAY2-NANO
          image: ubuntu_jammy
          securityGroupId: ${sg01.id}
      pnic01:
        type: scaleway:InstancePrivateNic
        properties:
          serverId: ${srv01.id}
          privateNetworkId: ${pn01.id}
      pn01:
        type: scaleway:VpcPrivateNetwork
      dhcp01:
        type: scaleway:VpcPublicGatewayDhcp
        properties:
          subnet: 192.168.0.0/24
      ip01:
        type: scaleway:VpcPublicGatewayIp
      pg01:
        type: scaleway:VpcPublicGateway
        properties:
          type: VPC-GW-S
          ipId: ${ip01.id}
      gn01:
        type: scaleway:VpcGatewayNetwork
        properties:
          gatewayId: ${pg01.id}
          privateNetworkId: ${pn01.id}
          dhcpId: ${dhcp01.id}
          cleanupDhcp: true
          enableMasquerade: true
      rsv01:
        type: scaleway:VpcPublicGatewayDhcpReservation
        properties:
          gatewayNetworkId: ${gn01.id}
          macAddress: ${pnic01.macAddress}
          ipAddress: 192.168.0.7
      pat01:
        type: scaleway:VpcPublicGatewayPatRule
        properties:
          gatewayId: ${pg01.id}
          privateIp: ${rsv01.ipAddress}
          privatePort: 22
          publicPort: 2202
          protocol: tcp
    variables:
      main:
        fn::invoke:
          Function: scaleway:getVpcPublicPatRule
          Arguments:
            patRuleId: ${pat01.id}
    

    Using getVpcPublicPatRule

    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 getVpcPublicPatRule(args: GetVpcPublicPatRuleArgs, opts?: InvokeOptions): Promise<GetVpcPublicPatRuleResult>
    function getVpcPublicPatRuleOutput(args: GetVpcPublicPatRuleOutputArgs, opts?: InvokeOptions): Output<GetVpcPublicPatRuleResult>
    def get_vpc_public_pat_rule(pat_rule_id: Optional[str] = None,
                                zone: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetVpcPublicPatRuleResult
    def get_vpc_public_pat_rule_output(pat_rule_id: Optional[pulumi.Input[str]] = None,
                                zone: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetVpcPublicPatRuleResult]
    func GetVpcPublicPatRule(ctx *Context, args *GetVpcPublicPatRuleArgs, opts ...InvokeOption) (*GetVpcPublicPatRuleResult, error)
    func GetVpcPublicPatRuleOutput(ctx *Context, args *GetVpcPublicPatRuleOutputArgs, opts ...InvokeOption) GetVpcPublicPatRuleResultOutput

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

    public static class GetVpcPublicPatRule 
    {
        public static Task<GetVpcPublicPatRuleResult> InvokeAsync(GetVpcPublicPatRuleArgs args, InvokeOptions? opts = null)
        public static Output<GetVpcPublicPatRuleResult> Invoke(GetVpcPublicPatRuleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcPublicPatRuleResult> getVpcPublicPatRule(GetVpcPublicPatRuleArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: scaleway:index/getVpcPublicPatRule:getVpcPublicPatRule
      arguments:
        # arguments dictionary

    The following arguments are supported:

    PatRuleId string
    The ID of the PAT rule to retrieve
    Zone string
    zone) The zone in which the image exists.
    PatRuleId string
    The ID of the PAT rule to retrieve
    Zone string
    zone) The zone in which the image exists.
    patRuleId String
    The ID of the PAT rule to retrieve
    zone String
    zone) The zone in which the image exists.
    patRuleId string
    The ID of the PAT rule to retrieve
    zone string
    zone) The zone in which the image exists.
    pat_rule_id str
    The ID of the PAT rule to retrieve
    zone str
    zone) The zone in which the image exists.
    patRuleId String
    The ID of the PAT rule to retrieve
    zone String
    zone) The zone in which the image exists.

    getVpcPublicPatRule Result

    The following output properties are available:

    CreatedAt string
    GatewayId string
    The ID of the public gateway.
    Id string
    The provider-assigned unique ID for this managed resource.
    OrganizationId string
    PatRuleId string
    PrivateIp string
    The Private IP to forward data to (IP address).
    PrivatePort int
    The Private port to translate to.
    Protocol string
    The Protocol the rule should apply to. Possible values are both, tcp and udp.
    PublicPort int
    The Public port to listen on.
    UpdatedAt string
    Zone string
    CreatedAt string
    GatewayId string
    The ID of the public gateway.
    Id string
    The provider-assigned unique ID for this managed resource.
    OrganizationId string
    PatRuleId string
    PrivateIp string
    The Private IP to forward data to (IP address).
    PrivatePort int
    The Private port to translate to.
    Protocol string
    The Protocol the rule should apply to. Possible values are both, tcp and udp.
    PublicPort int
    The Public port to listen on.
    UpdatedAt string
    Zone string
    createdAt String
    gatewayId String
    The ID of the public gateway.
    id String
    The provider-assigned unique ID for this managed resource.
    organizationId String
    patRuleId String
    privateIp String
    The Private IP to forward data to (IP address).
    privatePort Integer
    The Private port to translate to.
    protocol String
    The Protocol the rule should apply to. Possible values are both, tcp and udp.
    publicPort Integer
    The Public port to listen on.
    updatedAt String
    zone String
    createdAt string
    gatewayId string
    The ID of the public gateway.
    id string
    The provider-assigned unique ID for this managed resource.
    organizationId string
    patRuleId string
    privateIp string
    The Private IP to forward data to (IP address).
    privatePort number
    The Private port to translate to.
    protocol string
    The Protocol the rule should apply to. Possible values are both, tcp and udp.
    publicPort number
    The Public port to listen on.
    updatedAt string
    zone string
    created_at str
    gateway_id str
    The ID of the public gateway.
    id str
    The provider-assigned unique ID for this managed resource.
    organization_id str
    pat_rule_id str
    private_ip str
    The Private IP to forward data to (IP address).
    private_port int
    The Private port to translate to.
    protocol str
    The Protocol the rule should apply to. Possible values are both, tcp and udp.
    public_port int
    The Public port to listen on.
    updated_at str
    zone str
    createdAt String
    gatewayId String
    The ID of the public gateway.
    id String
    The provider-assigned unique ID for this managed resource.
    organizationId String
    patRuleId String
    privateIp String
    The Private IP to forward data to (IP address).
    privatePort Number
    The Private port to translate to.
    protocol String
    The Protocol the rule should apply to. Possible values are both, tcp and udp.
    publicPort Number
    The Public port to listen on.
    updatedAt String
    zone String

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse