1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. apigateway
  5. InstanceAclAttachment
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.apigateway.InstanceAclAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides an Instance ACL attachment resource for attaching an ACL to a specific API Gateway instance.

    NOTE: Available since v1.228.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform_example";
    const _default = new alicloud.apigateway.Instance("default", {
        instanceName: name,
        instanceSpec: "api.s1.small",
        httpsPolicy: "HTTPS2_TLS1_0",
        zoneId: "cn-hangzhou-MAZ6",
        paymentType: "PayAsYouGo",
        instanceType: "normal",
    });
    const defaultAccessControlList = new alicloud.apigateway.AccessControlList("default", {
        accessControlListName: name,
        addressIpVersion: "ipv4",
    });
    const defaultAclEntryAttachment = new alicloud.apigateway.AclEntryAttachment("default", {
        aclId: defaultAccessControlList.id,
        entry: "128.0.0.1/32",
        comment: "test comment",
    });
    const defaultInstanceAclAttachment = new alicloud.apigateway.InstanceAclAttachment("default", {
        instanceId: _default.id,
        aclId: defaultAccessControlList.id,
        aclType: "white",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform_example"
    default = alicloud.apigateway.Instance("default",
        instance_name=name,
        instance_spec="api.s1.small",
        https_policy="HTTPS2_TLS1_0",
        zone_id="cn-hangzhou-MAZ6",
        payment_type="PayAsYouGo",
        instance_type="normal")
    default_access_control_list = alicloud.apigateway.AccessControlList("default",
        access_control_list_name=name,
        address_ip_version="ipv4")
    default_acl_entry_attachment = alicloud.apigateway.AclEntryAttachment("default",
        acl_id=default_access_control_list.id,
        entry="128.0.0.1/32",
        comment="test comment")
    default_instance_acl_attachment = alicloud.apigateway.InstanceAclAttachment("default",
        instance_id=default.id,
        acl_id=default_access_control_list.id,
        acl_type="white")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform_example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := apigateway.NewInstance(ctx, "default", &apigateway.InstanceArgs{
    			InstanceName: pulumi.String(name),
    			InstanceSpec: pulumi.String("api.s1.small"),
    			HttpsPolicy:  pulumi.String("HTTPS2_TLS1_0"),
    			ZoneId:       pulumi.String("cn-hangzhou-MAZ6"),
    			PaymentType:  pulumi.String("PayAsYouGo"),
    			InstanceType: pulumi.String("normal"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultAccessControlList, err := apigateway.NewAccessControlList(ctx, "default", &apigateway.AccessControlListArgs{
    			AccessControlListName: pulumi.String(name),
    			AddressIpVersion:      pulumi.String("ipv4"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigateway.NewAclEntryAttachment(ctx, "default", &apigateway.AclEntryAttachmentArgs{
    			AclId:   defaultAccessControlList.ID(),
    			Entry:   pulumi.String("128.0.0.1/32"),
    			Comment: pulumi.String("test comment"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigateway.NewInstanceAclAttachment(ctx, "default", &apigateway.InstanceAclAttachmentArgs{
    			InstanceId: _default.ID(),
    			AclId:      defaultAccessControlList.ID(),
    			AclType:    pulumi.String("white"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform_example";
        var @default = new AliCloud.ApiGateway.Instance("default", new()
        {
            InstanceName = name,
            InstanceSpec = "api.s1.small",
            HttpsPolicy = "HTTPS2_TLS1_0",
            ZoneId = "cn-hangzhou-MAZ6",
            PaymentType = "PayAsYouGo",
            InstanceType = "normal",
        });
    
        var defaultAccessControlList = new AliCloud.ApiGateway.AccessControlList("default", new()
        {
            AccessControlListName = name,
            AddressIpVersion = "ipv4",
        });
    
        var defaultAclEntryAttachment = new AliCloud.ApiGateway.AclEntryAttachment("default", new()
        {
            AclId = defaultAccessControlList.Id,
            Entry = "128.0.0.1/32",
            Comment = "test comment",
        });
    
        var defaultInstanceAclAttachment = new AliCloud.ApiGateway.InstanceAclAttachment("default", new()
        {
            InstanceId = @default.Id,
            AclId = defaultAccessControlList.Id,
            AclType = "white",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.apigateway.Instance;
    import com.pulumi.alicloud.apigateway.InstanceArgs;
    import com.pulumi.alicloud.apigateway.AccessControlList;
    import com.pulumi.alicloud.apigateway.AccessControlListArgs;
    import com.pulumi.alicloud.apigateway.AclEntryAttachment;
    import com.pulumi.alicloud.apigateway.AclEntryAttachmentArgs;
    import com.pulumi.alicloud.apigateway.InstanceAclAttachment;
    import com.pulumi.alicloud.apigateway.InstanceAclAttachmentArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform_example");
            var default_ = new Instance("default", InstanceArgs.builder()
                .instanceName(name)
                .instanceSpec("api.s1.small")
                .httpsPolicy("HTTPS2_TLS1_0")
                .zoneId("cn-hangzhou-MAZ6")
                .paymentType("PayAsYouGo")
                .instanceType("normal")
                .build());
    
            var defaultAccessControlList = new AccessControlList("defaultAccessControlList", AccessControlListArgs.builder()
                .accessControlListName(name)
                .addressIpVersion("ipv4")
                .build());
    
            var defaultAclEntryAttachment = new AclEntryAttachment("defaultAclEntryAttachment", AclEntryAttachmentArgs.builder()
                .aclId(defaultAccessControlList.id())
                .entry("128.0.0.1/32")
                .comment("test comment")
                .build());
    
            var defaultInstanceAclAttachment = new InstanceAclAttachment("defaultInstanceAclAttachment", InstanceAclAttachmentArgs.builder()
                .instanceId(default_.id())
                .aclId(defaultAccessControlList.id())
                .aclType("white")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform_example
    resources:
      default:
        type: alicloud:apigateway:Instance
        properties:
          instanceName: ${name}
          instanceSpec: api.s1.small
          httpsPolicy: HTTPS2_TLS1_0
          zoneId: cn-hangzhou-MAZ6
          paymentType: PayAsYouGo
          instanceType: normal
      defaultAccessControlList:
        type: alicloud:apigateway:AccessControlList
        name: default
        properties:
          accessControlListName: ${name}
          addressIpVersion: ipv4
      defaultAclEntryAttachment:
        type: alicloud:apigateway:AclEntryAttachment
        name: default
        properties:
          aclId: ${defaultAccessControlList.id}
          entry: 128.0.0.1/32
          comment: test comment
      defaultInstanceAclAttachment:
        type: alicloud:apigateway:InstanceAclAttachment
        name: default
        properties:
          instanceId: ${default.id}
          aclId: ${defaultAccessControlList.id}
          aclType: white
    

    Create InstanceAclAttachment Resource

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

    Constructor syntax

    new InstanceAclAttachment(name: string, args: InstanceAclAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def InstanceAclAttachment(resource_name: str,
                              args: InstanceAclAttachmentArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def InstanceAclAttachment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              acl_id: Optional[str] = None,
                              acl_type: Optional[str] = None,
                              instance_id: Optional[str] = None)
    func NewInstanceAclAttachment(ctx *Context, name string, args InstanceAclAttachmentArgs, opts ...ResourceOption) (*InstanceAclAttachment, error)
    public InstanceAclAttachment(string name, InstanceAclAttachmentArgs args, CustomResourceOptions? opts = null)
    public InstanceAclAttachment(String name, InstanceAclAttachmentArgs args)
    public InstanceAclAttachment(String name, InstanceAclAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:apigateway:InstanceAclAttachment
    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 InstanceAclAttachmentArgs
    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 InstanceAclAttachmentArgs
    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 InstanceAclAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args InstanceAclAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args InstanceAclAttachmentArgs
    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 instanceAclAttachmentResource = new AliCloud.ApiGateway.InstanceAclAttachment("instanceAclAttachmentResource", new()
    {
        AclId = "string",
        AclType = "string",
        InstanceId = "string",
    });
    
    example, err := apigateway.NewInstanceAclAttachment(ctx, "instanceAclAttachmentResource", &apigateway.InstanceAclAttachmentArgs{
    	AclId:      pulumi.String("string"),
    	AclType:    pulumi.String("string"),
    	InstanceId: pulumi.String("string"),
    })
    
    var instanceAclAttachmentResource = new InstanceAclAttachment("instanceAclAttachmentResource", InstanceAclAttachmentArgs.builder()
        .aclId("string")
        .aclType("string")
        .instanceId("string")
        .build());
    
    instance_acl_attachment_resource = alicloud.apigateway.InstanceAclAttachment("instanceAclAttachmentResource",
        acl_id="string",
        acl_type="string",
        instance_id="string")
    
    const instanceAclAttachmentResource = new alicloud.apigateway.InstanceAclAttachment("instanceAclAttachmentResource", {
        aclId: "string",
        aclType: "string",
        instanceId: "string",
    });
    
    type: alicloud:apigateway:InstanceAclAttachment
    properties:
        aclId: string
        aclType: string
        instanceId: string
    

    InstanceAclAttachment Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The InstanceAclAttachment resource accepts the following input properties:

    AclId string
    The ID of the ACL to attach.
    AclType string
    The type of the ACL. Valid values: white, black.
    InstanceId string
    The ID of the API Gateway instance that the ACL will be attached to.
    AclId string
    The ID of the ACL to attach.
    AclType string
    The type of the ACL. Valid values: white, black.
    InstanceId string
    The ID of the API Gateway instance that the ACL will be attached to.
    aclId String
    The ID of the ACL to attach.
    aclType String
    The type of the ACL. Valid values: white, black.
    instanceId String
    The ID of the API Gateway instance that the ACL will be attached to.
    aclId string
    The ID of the ACL to attach.
    aclType string
    The type of the ACL. Valid values: white, black.
    instanceId string
    The ID of the API Gateway instance that the ACL will be attached to.
    acl_id str
    The ID of the ACL to attach.
    acl_type str
    The type of the ACL. Valid values: white, black.
    instance_id str
    The ID of the API Gateway instance that the ACL will be attached to.
    aclId String
    The ID of the ACL to attach.
    aclType String
    The type of the ACL. Valid values: white, black.
    instanceId String
    The ID of the API Gateway instance that the ACL will be attached to.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing InstanceAclAttachment Resource

    Get an existing InstanceAclAttachment 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?: InstanceAclAttachmentState, opts?: CustomResourceOptions): InstanceAclAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            acl_id: Optional[str] = None,
            acl_type: Optional[str] = None,
            instance_id: Optional[str] = None) -> InstanceAclAttachment
    func GetInstanceAclAttachment(ctx *Context, name string, id IDInput, state *InstanceAclAttachmentState, opts ...ResourceOption) (*InstanceAclAttachment, error)
    public static InstanceAclAttachment Get(string name, Input<string> id, InstanceAclAttachmentState? state, CustomResourceOptions? opts = null)
    public static InstanceAclAttachment get(String name, Output<String> id, InstanceAclAttachmentState 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:
    AclId string
    The ID of the ACL to attach.
    AclType string
    The type of the ACL. Valid values: white, black.
    InstanceId string
    The ID of the API Gateway instance that the ACL will be attached to.
    AclId string
    The ID of the ACL to attach.
    AclType string
    The type of the ACL. Valid values: white, black.
    InstanceId string
    The ID of the API Gateway instance that the ACL will be attached to.
    aclId String
    The ID of the ACL to attach.
    aclType String
    The type of the ACL. Valid values: white, black.
    instanceId String
    The ID of the API Gateway instance that the ACL will be attached to.
    aclId string
    The ID of the ACL to attach.
    aclType string
    The type of the ACL. Valid values: white, black.
    instanceId string
    The ID of the API Gateway instance that the ACL will be attached to.
    acl_id str
    The ID of the ACL to attach.
    acl_type str
    The type of the ACL. Valid values: white, black.
    instance_id str
    The ID of the API Gateway instance that the ACL will be attached to.
    aclId String
    The ID of the ACL to attach.
    aclType String
    The type of the ACL. Valid values: white, black.
    instanceId String
    The ID of the API Gateway instance that the ACL will be attached to.

    Import

    Api Gateway Instance Acl Attachment can be imported using the id, e.g.

    $ pulumi import alicloud:apigateway/instanceAclAttachment:InstanceAclAttachment example <instance_id>:<acl_id>:<acl_type>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi