Resource: awsServiceDiscoveryInstance
Provides a Service Discovery Instance resource.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsVpcExample = new aws.vpc.Vpc(this, "example", {
cidrBlock: "10.0.0.0/16",
enableDnsHostnames: true,
enableDnsSupport: true,
});
const awsServiceDiscoveryPrivateDnsNamespaceExample =
new aws.serviceDiscoveryPrivateDnsNamespace.ServiceDiscoveryPrivateDnsNamespace(
this,
"example_1",
{
description: "example",
name: "example.terraform.local",
vpc: awsVpcExample.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsServiceDiscoveryPrivateDnsNamespaceExample.overrideLogicalId("example");
const awsServiceDiscoveryServiceExample =
new aws.serviceDiscoveryService.ServiceDiscoveryService(this, "example_2", {
dnsConfig: {
dnsRecords: [
{
ttl: 10,
type: "A",
},
],
namespaceId: awsServiceDiscoveryPrivateDnsNamespaceExample.id,
routingPolicy: "MULTIVALUE",
},
healthCheckCustomConfig: {
failureThreshold: 1,
},
name: "example",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsServiceDiscoveryServiceExample.overrideLogicalId("example");
const awsServiceDiscoveryInstanceExample =
new aws.serviceDiscoveryInstance.ServiceDiscoveryInstance(this, "example_3", {
attributes: {
AWS_INSTANCE_IPV4: "172.18.0.1",
custom_attribute: "custom",
},
instanceId: "example-instance-id",
serviceId: awsServiceDiscoveryServiceExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsServiceDiscoveryInstanceExample.overrideLogicalId("example");
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsServiceDiscoveryHttpNamespaceExample =
new aws.serviceDiscoveryHttpNamespace.ServiceDiscoveryHttpNamespace(
this,
"example",
{
description: "example",
name: "example.terraform.com",
}
);
const awsServiceDiscoveryServiceExample =
new aws.serviceDiscoveryService.ServiceDiscoveryService(this, "example_1", {
name: "example",
namespaceId: awsServiceDiscoveryHttpNamespaceExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsServiceDiscoveryServiceExample.overrideLogicalId("example");
const awsServiceDiscoveryInstanceExample =
new aws.serviceDiscoveryInstance.ServiceDiscoveryInstance(this, "example_2", {
attributes: {
AWS_EC2_INSTANCE_ID: "i-0abdg374kd892cj6dl",
},
instanceId: "example-instance-id",
serviceId: awsServiceDiscoveryServiceExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsServiceDiscoveryInstanceExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
instanceId
- (Required, ForceNew) The ID of the service instance.serviceId
- (Required, ForceNew) The ID of the service that you want to use to create the instance.attributes
- (Required) A map contains the attributes of the instance. Check the doc for the supported attributes and syntax.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The ID of the instance.
Import
Service Discovery Instance can be imported using the service ID and instance ID, e.g.,