@@ -166,9 +166,7 @@ provider "coder" {
166166 Request : & proto.Provision_Request {
167167 Type : & proto.Provision_Request_Start {
168168 Start : & proto.Provision_Start {
169- Metadata : & proto.Provision_Metadata {
170- CoderUrl : "https://example.com" ,
171- },
169+ Metadata : & proto.Provision_Metadata {},
172170 },
173171 },
174172 },
@@ -195,16 +193,14 @@ provider "coder" {
195193 depends_on = [
196194 null_resource.A
197195 ]
198- instance_id = "an-instance "
196+ instance_id = "example "
199197 }
200198 resource "null_resource" "A" {}` ,
201199 },
202200 Request : & proto.Provision_Request {
203201 Type : & proto.Provision_Request_Start {
204202 Start : & proto.Provision_Start {
205- Metadata : & proto.Provision_Metadata {
206- CoderUrl : "https://example.com" ,
207- },
203+ Metadata : & proto.Provision_Metadata {},
208204 },
209205 },
210206 },
@@ -214,6 +210,11 @@ provider "coder" {
214210 Resources : []* proto.Resource {{
215211 Name : "A" ,
216212 Type : "null_resource" ,
213+ Agent : & proto.Agent {
214+ Auth : & proto.Agent_InstanceId {
215+ InstanceId : "example" ,
216+ },
217+ },
217218 }},
218219 },
219220 },
@@ -232,10 +233,8 @@ provider "coder" {
232233 Request : & proto.Provision_Request {
233234 Type : & proto.Provision_Request_Start {
234235 Start : & proto.Provision_Start {
235- DryRun : true ,
236- Metadata : & proto.Provision_Metadata {
237- CoderUrl : "https://example.com" ,
238- },
236+ DryRun : true ,
237+ Metadata : & proto.Provision_Metadata {},
239238 },
240239 },
241240 },
@@ -267,10 +266,8 @@ provider "coder" {
267266 Request : & proto.Provision_Request {
268267 Type : & proto.Provision_Request_Start {
269268 Start : & proto.Provision_Start {
270- DryRun : true ,
271- Metadata : & proto.Provision_Metadata {
272- CoderUrl : "https://example.com" ,
273- },
269+ DryRun : true ,
270+ Metadata : & proto.Provision_Metadata {},
274271 },
275272 },
276273 },
@@ -289,6 +286,41 @@ provider "coder" {
289286 },
290287 },
291288 },
289+ }, {
290+ Name : "dryrun-agent-associated-with-resource-instance-id" ,
291+ Files : map [string ]string {
292+ "main.tf" : provider + `
293+ resource "coder_agent" "A" {
294+ count = length(null_resource.A)
295+ instance_id = length(null_resource.A)
296+ }
297+ resource "null_resource" "A" {
298+ count = 1
299+ }` ,
300+ },
301+ Request : & proto.Provision_Request {
302+ Type : & proto.Provision_Request_Start {
303+ Start : & proto.Provision_Start {
304+ DryRun : true ,
305+ Metadata : & proto.Provision_Metadata {},
306+ },
307+ },
308+ },
309+ Response : & proto.Provision_Response {
310+ Type : & proto.Provision_Response_Complete {
311+ Complete : & proto.Provision_Complete {
312+ Resources : []* proto.Resource {{
313+ Name : "A" ,
314+ Type : "null_resource" ,
315+ Agent : & proto.Agent {
316+ Auth : & proto.Agent_InstanceId {
317+ InstanceId : "" ,
318+ },
319+ },
320+ }},
321+ },
322+ },
323+ },
292324 }} {
293325 testCase := testCase
294326 t .Run (testCase .Name , func (t * testing.T ) {
0 commit comments