Skip to content

AccessInfrastructureTarget

Source: src/Cloudflare/Access/InfrastructureTarget.ts

A Cloudflare Access Infrastructure Target — a server (hostname + IPv4/IPv6 address) protected by Access for Infrastructure (SSH).

Targets are referenced by infrastructure Access applications, which attach SSH access policies to them. Hostname and IP are both mutable in place; the target’s identity is its Cloudflare-assigned UUID.

Basic IPv4 target

const target = yield* Cloudflare.AccessInfrastructureTarget("Bastion", {
hostname: "bastion.internal",
ip: { ipv4: { ipAddr: "10.0.0.5" } },
});

Target scoped to a virtual network

const vnet = yield* Cloudflare.TunnelVirtualNetwork("Staging", {});
const target = yield* Cloudflare.AccessInfrastructureTarget("DbHost", {
hostname: "db.staging.internal",
ip: {
ipv4: {
ipAddr: "10.4.0.10",
virtualNetworkId: vnet.virtualNetworkId,
},
},
});
// Hostname and IP update in place — same targetId, no replacement.
const target = yield* Cloudflare.AccessInfrastructureTarget("Bastion", {
hostname: "bastion.internal",
ip: { ipv4: { ipAddr: "10.0.0.6" } },
});