@@ -97,6 +97,12 @@ func resourceOsConfigOsPolicyAssignment() *schema.Resource {
97
97
Description : "The project for the resource" ,
98
98
},
99
99
100
+ "skip_await_rollout" : {
101
+ Type : schema .TypeBool ,
102
+ Optional : true ,
103
+ Description : "Set to true to skip awaiting rollout during resource creation and update." ,
104
+ },
105
+
100
106
"baseline" : {
101
107
Type : schema .TypeBool ,
102
108
Computed : true ,
@@ -1316,13 +1322,14 @@ func resourceOsConfigOsPolicyAssignmentCreate(d *schema.ResourceData, meta inter
1316
1322
}
1317
1323
1318
1324
obj := & osconfig.OSPolicyAssignment {
1319
- InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1320
- Location : dcl .String (d .Get ("location" ).(string )),
1321
- Name : dcl .String (d .Get ("name" ).(string )),
1322
- OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1323
- Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1324
- Description : dcl .String (d .Get ("description" ).(string )),
1325
- Project : dcl .String (project ),
1325
+ InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1326
+ Location : dcl .String (d .Get ("location" ).(string )),
1327
+ Name : dcl .String (d .Get ("name" ).(string )),
1328
+ OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1329
+ Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1330
+ Description : dcl .String (d .Get ("description" ).(string )),
1331
+ Project : dcl .String (project ),
1332
+ SkipAwaitRollout : dcl .Bool (d .Get ("skip_await_rollout" ).(bool )),
1326
1333
}
1327
1334
1328
1335
id , err := obj .ID ()
@@ -1370,13 +1377,14 @@ func resourceOsConfigOsPolicyAssignmentRead(d *schema.ResourceData, meta interfa
1370
1377
}
1371
1378
1372
1379
obj := & osconfig.OSPolicyAssignment {
1373
- InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1374
- Location : dcl .String (d .Get ("location" ).(string )),
1375
- Name : dcl .String (d .Get ("name" ).(string )),
1376
- OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1377
- Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1378
- Description : dcl .String (d .Get ("description" ).(string )),
1379
- Project : dcl .String (project ),
1380
+ InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1381
+ Location : dcl .String (d .Get ("location" ).(string )),
1382
+ Name : dcl .String (d .Get ("name" ).(string )),
1383
+ OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1384
+ Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1385
+ Description : dcl .String (d .Get ("description" ).(string )),
1386
+ Project : dcl .String (project ),
1387
+ SkipAwaitRollout : dcl .Bool (d .Get ("skip_await_rollout" ).(bool )),
1380
1388
}
1381
1389
1382
1390
userAgent , err := generateUserAgentString (d , config .userAgent )
@@ -1422,6 +1430,9 @@ func resourceOsConfigOsPolicyAssignmentRead(d *schema.ResourceData, meta interfa
1422
1430
if err = d .Set ("project" , res .Project ); err != nil {
1423
1431
return fmt .Errorf ("error setting project in state: %s" , err )
1424
1432
}
1433
+ if err = d .Set ("skip_await_rollout" , res .SkipAwaitRollout ); err != nil {
1434
+ return fmt .Errorf ("error setting skip_await_rollout in state: %s" , err )
1435
+ }
1425
1436
if err = d .Set ("baseline" , res .Baseline ); err != nil {
1426
1437
return fmt .Errorf ("error setting baseline in state: %s" , err )
1427
1438
}
@@ -1457,15 +1468,28 @@ func resourceOsConfigOsPolicyAssignmentUpdate(d *schema.ResourceData, meta inter
1457
1468
}
1458
1469
1459
1470
obj := & osconfig.OSPolicyAssignment {
1460
- InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1461
- Location : dcl .String (d .Get ("location" ).(string )),
1462
- Name : dcl .String (d .Get ("name" ).(string )),
1463
- OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1464
- Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1465
- Description : dcl .String (d .Get ("description" ).(string )),
1466
- Project : dcl .String (project ),
1471
+ InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1472
+ Location : dcl .String (d .Get ("location" ).(string )),
1473
+ Name : dcl .String (d .Get ("name" ).(string )),
1474
+ OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1475
+ Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1476
+ Description : dcl .String (d .Get ("description" ).(string )),
1477
+ Project : dcl .String (project ),
1478
+ SkipAwaitRollout : dcl .Bool (d .Get ("skip_await_rollout" ).(bool )),
1479
+ }
1480
+ // Construct state hint from old values
1481
+ old := & osconfig.OSPolicyAssignment {
1482
+ InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (oldValue (d .GetChange ("instance_filter" ))),
1483
+ Location : dcl .String (oldValue (d .GetChange ("location" )).(string )),
1484
+ Name : dcl .String (oldValue (d .GetChange ("name" )).(string )),
1485
+ OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (oldValue (d .GetChange ("os_policies" ))),
1486
+ Rollout : expandOsConfigOsPolicyAssignmentRollout (oldValue (d .GetChange ("rollout" ))),
1487
+ Description : dcl .String (oldValue (d .GetChange ("description" )).(string )),
1488
+ Project : dcl .StringOrNil (oldValue (d .GetChange ("project" )).(string )),
1489
+ SkipAwaitRollout : dcl .Bool (oldValue (d .GetChange ("skip_await_rollout" )).(bool )),
1467
1490
}
1468
1491
directive := UpdateDirective
1492
+ directive = append (directive , dcl .WithStateHint (old ))
1469
1493
userAgent , err := generateUserAgentString (d , config .userAgent )
1470
1494
if err != nil {
1471
1495
return err
@@ -1506,13 +1530,14 @@ func resourceOsConfigOsPolicyAssignmentDelete(d *schema.ResourceData, meta inter
1506
1530
}
1507
1531
1508
1532
obj := & osconfig.OSPolicyAssignment {
1509
- InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1510
- Location : dcl .String (d .Get ("location" ).(string )),
1511
- Name : dcl .String (d .Get ("name" ).(string )),
1512
- OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1513
- Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1514
- Description : dcl .String (d .Get ("description" ).(string )),
1515
- Project : dcl .String (project ),
1533
+ InstanceFilter : expandOsConfigOsPolicyAssignmentInstanceFilter (d .Get ("instance_filter" )),
1534
+ Location : dcl .String (d .Get ("location" ).(string )),
1535
+ Name : dcl .String (d .Get ("name" ).(string )),
1536
+ OSPolicies : expandOsConfigOsPolicyAssignmentOSPoliciesArray (d .Get ("os_policies" )),
1537
+ Rollout : expandOsConfigOsPolicyAssignmentRollout (d .Get ("rollout" )),
1538
+ Description : dcl .String (d .Get ("description" ).(string )),
1539
+ Project : dcl .String (project ),
1540
+ SkipAwaitRollout : dcl .Bool (d .Get ("skip_await_rollout" ).(bool )),
1516
1541
}
1517
1542
1518
1543
log .Printf ("[DEBUG] Deleting OSPolicyAssignment %q" , d .Id ())
0 commit comments