tencentcloud.MqttInstancePublicEndpoint
Explore with Pulumi AI
Provides a resource to create a MQTT instance public endpoint
NOTE: This resource must exclusive in one MQTT instance, do not declare additional public endpoint resources of this instance elsewhere.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const config = new pulumi.Config();
const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-6";
// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create subnet
const subnet = new tencentcloud.Subnet("subnet", {
vpcId: vpc.vpcId,
availabilityZone: availabilityZone,
cidrBlock: "10.0.1.0/24",
isMulticast: false,
});
// create mqtt instance
const exampleMqttInstance = new tencentcloud.MqttInstance("exampleMqttInstance", {
instanceType: "BASIC",
skuCode: "basic_2k",
remark: "remarks.",
vpcList: {
vpcId: vpc.vpcId,
subnetId: subnet.subnetId,
},
payMode: 0,
tags: {
createBy: "Terraform",
},
});
// create public endpoint
const exampleMqttInstancePublicEndpoint = new tencentcloud.MqttInstancePublicEndpoint("exampleMqttInstancePublicEndpoint", {
instanceId: exampleMqttInstance.mqttInstanceId,
bandwidth: 100,
rules: [
{
ipRule: "192.168.1.0/24",
remark: "Remark.",
},
{
ipRule: "172.16.1.0/24",
remark: "Remark.",
},
],
});
import pulumi
import pulumi_tencentcloud as tencentcloud
config = pulumi.Config()
availability_zone = config.get("availabilityZone")
if availability_zone is None:
availability_zone = "ap-guangzhou-6"
# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create subnet
subnet = tencentcloud.Subnet("subnet",
vpc_id=vpc.vpc_id,
availability_zone=availability_zone,
cidr_block="10.0.1.0/24",
is_multicast=False)
# create mqtt instance
example_mqtt_instance = tencentcloud.MqttInstance("exampleMqttInstance",
instance_type="BASIC",
sku_code="basic_2k",
remark="remarks.",
vpc_list={
"vpc_id": vpc.vpc_id,
"subnet_id": subnet.subnet_id,
},
pay_mode=0,
tags={
"createBy": "Terraform",
})
# create public endpoint
example_mqtt_instance_public_endpoint = tencentcloud.MqttInstancePublicEndpoint("exampleMqttInstancePublicEndpoint",
instance_id=example_mqtt_instance.mqtt_instance_id,
bandwidth=100,
rules=[
{
"ip_rule": "192.168.1.0/24",
"remark": "Remark.",
},
{
"ip_rule": "172.16.1.0/24",
"remark": "Remark.",
},
])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"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, "")
availabilityZone := "ap-guangzhou-6"
if param := cfg.Get("availabilityZone"); param != "" {
availabilityZone = param
}
// create vpc
vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
// create subnet
subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
VpcId: vpc.VpcId,
AvailabilityZone: pulumi.String(availabilityZone),
CidrBlock: pulumi.String("10.0.1.0/24"),
IsMulticast: pulumi.Bool(false),
})
if err != nil {
return err
}
// create mqtt instance
exampleMqttInstance, err := tencentcloud.NewMqttInstance(ctx, "exampleMqttInstance", &tencentcloud.MqttInstanceArgs{
InstanceType: pulumi.String("BASIC"),
SkuCode: pulumi.String("basic_2k"),
Remark: pulumi.String("remarks."),
VpcList: &tencentcloud.MqttInstanceVpcListArgs{
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
},
PayMode: pulumi.Float64(0),
Tags: pulumi.StringMap{
"createBy": pulumi.String("Terraform"),
},
})
if err != nil {
return err
}
// create public endpoint
_, err = tencentcloud.NewMqttInstancePublicEndpoint(ctx, "exampleMqttInstancePublicEndpoint", &tencentcloud.MqttInstancePublicEndpointArgs{
InstanceId: exampleMqttInstance.MqttInstanceId,
Bandwidth: pulumi.Float64(100),
Rules: tencentcloud.MqttInstancePublicEndpointRuleArray{
&tencentcloud.MqttInstancePublicEndpointRuleArgs{
IpRule: pulumi.String("192.168.1.0/24"),
Remark: pulumi.String("Remark."),
},
&tencentcloud.MqttInstancePublicEndpointRuleArgs{
IpRule: pulumi.String("172.16.1.0/24"),
Remark: pulumi.String("Remark."),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-6";
// create vpc
var vpc = new Tencentcloud.Vpc("vpc", new()
{
CidrBlock = "10.0.0.0/16",
});
// create subnet
var subnet = new Tencentcloud.Subnet("subnet", new()
{
VpcId = vpc.VpcId,
AvailabilityZone = availabilityZone,
CidrBlock = "10.0.1.0/24",
IsMulticast = false,
});
// create mqtt instance
var exampleMqttInstance = new Tencentcloud.MqttInstance("exampleMqttInstance", new()
{
InstanceType = "BASIC",
SkuCode = "basic_2k",
Remark = "remarks.",
VpcList = new Tencentcloud.Inputs.MqttInstanceVpcListArgs
{
VpcId = vpc.VpcId,
SubnetId = subnet.SubnetId,
},
PayMode = 0,
Tags =
{
{ "createBy", "Terraform" },
},
});
// create public endpoint
var exampleMqttInstancePublicEndpoint = new Tencentcloud.MqttInstancePublicEndpoint("exampleMqttInstancePublicEndpoint", new()
{
InstanceId = exampleMqttInstance.MqttInstanceId,
Bandwidth = 100,
Rules = new[]
{
new Tencentcloud.Inputs.MqttInstancePublicEndpointRuleArgs
{
IpRule = "192.168.1.0/24",
Remark = "Remark.",
},
new Tencentcloud.Inputs.MqttInstancePublicEndpointRuleArgs
{
IpRule = "172.16.1.0/24",
Remark = "Remark.",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.MqttInstance;
import com.pulumi.tencentcloud.MqttInstanceArgs;
import com.pulumi.tencentcloud.inputs.MqttInstanceVpcListArgs;
import com.pulumi.tencentcloud.MqttInstancePublicEndpoint;
import com.pulumi.tencentcloud.MqttInstancePublicEndpointArgs;
import com.pulumi.tencentcloud.inputs.MqttInstancePublicEndpointRuleArgs;
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 availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-6");
// create vpc
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
// create subnet
var subnet = new Subnet("subnet", SubnetArgs.builder()
.vpcId(vpc.vpcId())
.availabilityZone(availabilityZone)
.cidrBlock("10.0.1.0/24")
.isMulticast(false)
.build());
// create mqtt instance
var exampleMqttInstance = new MqttInstance("exampleMqttInstance", MqttInstanceArgs.builder()
.instanceType("BASIC")
.skuCode("basic_2k")
.remark("remarks.")
.vpcList(MqttInstanceVpcListArgs.builder()
.vpcId(vpc.vpcId())
.subnetId(subnet.subnetId())
.build())
.payMode(0)
.tags(Map.of("createBy", "Terraform"))
.build());
// create public endpoint
var exampleMqttInstancePublicEndpoint = new MqttInstancePublicEndpoint("exampleMqttInstancePublicEndpoint", MqttInstancePublicEndpointArgs.builder()
.instanceId(exampleMqttInstance.mqttInstanceId())
.bandwidth(100)
.rules(
MqttInstancePublicEndpointRuleArgs.builder()
.ipRule("192.168.1.0/24")
.remark("Remark.")
.build(),
MqttInstancePublicEndpointRuleArgs.builder()
.ipRule("172.16.1.0/24")
.remark("Remark.")
.build())
.build());
}
}
configuration:
availabilityZone:
type: string
default: ap-guangzhou-6
resources:
# create vpc
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
# create subnet
subnet:
type: tencentcloud:Subnet
properties:
vpcId: ${vpc.vpcId}
availabilityZone: ${availabilityZone}
cidrBlock: 10.0.1.0/24
isMulticast: false
# create mqtt instance
exampleMqttInstance:
type: tencentcloud:MqttInstance
properties:
instanceType: BASIC
skuCode: basic_2k
remark: remarks.
vpcList:
vpcId: ${vpc.vpcId}
subnetId: ${subnet.subnetId}
payMode: 0
tags:
createBy: Terraform
# create public endpoint
exampleMqttInstancePublicEndpoint:
type: tencentcloud:MqttInstancePublicEndpoint
properties:
instanceId: ${exampleMqttInstance.mqttInstanceId}
bandwidth: 100
rules:
- ipRule: 192.168.1.0/24
remark: Remark.
- ipRule: 172.16.1.0/24
remark: Remark.
Create MqttInstancePublicEndpoint Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MqttInstancePublicEndpoint(name: string, args: MqttInstancePublicEndpointArgs, opts?: CustomResourceOptions);
@overload
def MqttInstancePublicEndpoint(resource_name: str,
args: MqttInstancePublicEndpointArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MqttInstancePublicEndpoint(resource_name: str,
opts: Optional[ResourceOptions] = None,
bandwidth: Optional[float] = None,
instance_id: Optional[str] = None,
mqtt_instance_public_endpoint_id: Optional[str] = None,
rules: Optional[Sequence[MqttInstancePublicEndpointRuleArgs]] = None)
func NewMqttInstancePublicEndpoint(ctx *Context, name string, args MqttInstancePublicEndpointArgs, opts ...ResourceOption) (*MqttInstancePublicEndpoint, error)
public MqttInstancePublicEndpoint(string name, MqttInstancePublicEndpointArgs args, CustomResourceOptions? opts = null)
public MqttInstancePublicEndpoint(String name, MqttInstancePublicEndpointArgs args)
public MqttInstancePublicEndpoint(String name, MqttInstancePublicEndpointArgs args, CustomResourceOptions options)
type: tencentcloud:MqttInstancePublicEndpoint
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 MqttInstancePublicEndpointArgs
- 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 MqttInstancePublicEndpointArgs
- 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 MqttInstancePublicEndpointArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MqttInstancePublicEndpointArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MqttInstancePublicEndpointArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
MqttInstancePublicEndpoint 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 MqttInstancePublicEndpoint resource accepts the following input properties:
- Bandwidth double
- Bandwidth, unit: Mbps.
- Instance
Id string - MQTT instance ID.
- Mqtt
Instance stringPublic Endpoint Id - ID of the resource.
- Rules
List<Mqtt
Instance Public Endpoint Rule> - White List of Public Network Access Rules.
- Bandwidth float64
- Bandwidth, unit: Mbps.
- Instance
Id string - MQTT instance ID.
- Mqtt
Instance stringPublic Endpoint Id - ID of the resource.
- Rules
[]Mqtt
Instance Public Endpoint Rule Args - White List of Public Network Access Rules.
- bandwidth Double
- Bandwidth, unit: Mbps.
- instance
Id String - MQTT instance ID.
- mqtt
Instance StringPublic Endpoint Id - ID of the resource.
- rules
List<Mqtt
Instance Public Endpoint Rule> - White List of Public Network Access Rules.
- bandwidth number
- Bandwidth, unit: Mbps.
- instance
Id string - MQTT instance ID.
- mqtt
Instance stringPublic Endpoint Id - ID of the resource.
- rules
Mqtt
Instance Public Endpoint Rule[] - White List of Public Network Access Rules.
- bandwidth float
- Bandwidth, unit: Mbps.
- instance_
id str - MQTT instance ID.
- mqtt_
instance_ strpublic_ endpoint_ id - ID of the resource.
- rules
Sequence[Mqtt
Instance Public Endpoint Rule Args] - White List of Public Network Access Rules.
- bandwidth Number
- Bandwidth, unit: Mbps.
- instance
Id String - MQTT instance ID.
- mqtt
Instance StringPublic Endpoint Id - ID of the resource.
- rules List<Property Map>
- White List of Public Network Access Rules.
Outputs
All input properties are implicitly available as output properties. Additionally, the MqttInstancePublicEndpoint 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 MqttInstancePublicEndpoint Resource
Get an existing MqttInstancePublicEndpoint 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?: MqttInstancePublicEndpointState, opts?: CustomResourceOptions): MqttInstancePublicEndpoint
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bandwidth: Optional[float] = None,
instance_id: Optional[str] = None,
mqtt_instance_public_endpoint_id: Optional[str] = None,
rules: Optional[Sequence[MqttInstancePublicEndpointRuleArgs]] = None) -> MqttInstancePublicEndpoint
func GetMqttInstancePublicEndpoint(ctx *Context, name string, id IDInput, state *MqttInstancePublicEndpointState, opts ...ResourceOption) (*MqttInstancePublicEndpoint, error)
public static MqttInstancePublicEndpoint Get(string name, Input<string> id, MqttInstancePublicEndpointState? state, CustomResourceOptions? opts = null)
public static MqttInstancePublicEndpoint get(String name, Output<String> id, MqttInstancePublicEndpointState state, CustomResourceOptions options)
resources: _: type: tencentcloud:MqttInstancePublicEndpoint get: id: ${id}
- 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.
- Bandwidth double
- Bandwidth, unit: Mbps.
- Instance
Id string - MQTT instance ID.
- Mqtt
Instance stringPublic Endpoint Id - ID of the resource.
- Rules
List<Mqtt
Instance Public Endpoint Rule> - White List of Public Network Access Rules.
- Bandwidth float64
- Bandwidth, unit: Mbps.
- Instance
Id string - MQTT instance ID.
- Mqtt
Instance stringPublic Endpoint Id - ID of the resource.
- Rules
[]Mqtt
Instance Public Endpoint Rule Args - White List of Public Network Access Rules.
- bandwidth Double
- Bandwidth, unit: Mbps.
- instance
Id String - MQTT instance ID.
- mqtt
Instance StringPublic Endpoint Id - ID of the resource.
- rules
List<Mqtt
Instance Public Endpoint Rule> - White List of Public Network Access Rules.
- bandwidth number
- Bandwidth, unit: Mbps.
- instance
Id string - MQTT instance ID.
- mqtt
Instance stringPublic Endpoint Id - ID of the resource.
- rules
Mqtt
Instance Public Endpoint Rule[] - White List of Public Network Access Rules.
- bandwidth float
- Bandwidth, unit: Mbps.
- instance_
id str - MQTT instance ID.
- mqtt_
instance_ strpublic_ endpoint_ id - ID of the resource.
- rules
Sequence[Mqtt
Instance Public Endpoint Rule Args] - White List of Public Network Access Rules.
- bandwidth Number
- Bandwidth, unit: Mbps.
- instance
Id String - MQTT instance ID.
- mqtt
Instance StringPublic Endpoint Id - ID of the resource.
- rules List<Property Map>
- White List of Public Network Access Rules.
Supporting Types
MqttInstancePublicEndpointRule, MqttInstancePublicEndpointRuleArgs
Import
MQTT instance public endpoint can be imported using the id, e.g.
$ pulumi import tencentcloud:index/mqttInstancePublicEndpoint:MqttInstancePublicEndpoint example mqtt-emb2v5wk
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.