@@ -285,6 +285,14 @@ func resourceIntegrationCloudRead(ctx context.Context, d *schema.ResourceData, m
285285 d .SetId (res .Msg .Cloud .Id )
286286 d .Set ("name" , res .Msg .Cloud .Name )
287287
288+ existingAwsConfig := d .Get ("aws" ).([]interface {})
289+ var existingAwsCustomerRoleArn string
290+
291+ if len (existingAwsConfig ) > 0 {
292+ existingAwsConfig := existingAwsConfig [0 ].(map [string ]interface {})
293+ existingAwsCustomerRoleArn = existingAwsConfig ["aws_customer_role_arn" ].(string )
294+ }
295+
288296 switch data := res .Msg .Cloud .Cloud .(type ) {
289297 case * corev1.CloudIntegration_Aws :
290298 d .Set ("type" , "aws" )
@@ -300,8 +308,13 @@ func resourceIntegrationCloudRead(ctx context.Context, d *schema.ResourceData, m
300308 "enable_s3_autodiscovery" : data .Aws .AwsEnableS3Autodiscovery ,
301309 "allow_s3_access" : data .Aws .AwsAllowS3Access ,
302310 "s3_bucket_arn" : data .Aws .AwsS3BucketArn ,
303- "aws_customer_role_arn" : data .Aws .AwsCustomerRoleArn ,
304311 }
312+
313+ // Only set the customer role ARN if it was set in the existing config
314+ if existingAwsCustomerRoleArn != "" {
315+ awsConfig ["aws_customer_role_arn" ] = data .Aws .AwsCustomerRoleArn
316+ }
317+
305318 if err := d .Set ("aws" , []interface {}{awsConfig }); err != nil {
306319 return diag .FromErr (err )
307320 }
@@ -319,7 +332,6 @@ func resourceIntegrationCloudRead(ctx context.Context, d *schema.ResourceData, m
319332 d .Set ("aws_enable_s3_autodiscovery" , data .Aws .AwsEnableS3Autodiscovery )
320333 d .Set ("aws_allow_s3_access" , data .Aws .AwsAllowS3Access )
321334 d .Set ("aws_s3_bucket_arn" , data .Aws .AwsS3BucketArn )
322- d .Set ("aws_customer_role_arn" , data .Aws .AwsCustomerRoleArn )
323335 }
324336
325337 return diags
@@ -333,7 +345,7 @@ func resourceIntegrationCloudUpdate(ctx context.Context, d *schema.ResourceData,
333345
334346 // These fields can't be updated, but they can still be changed by
335347 // CustomizeDiff when their 'aws.0.' counterpart has changes
336- fieldsThatCanChange := append (fieldsThatCanBeUpdated , []string {"aws_enable_eks_autodiscovery" , "aws_enable_rds_autodiscovery" , "aws_enable_redshift_autodiscovery" , "aws_enable_ecs_autodiscovery" , "aws_enable_ec2_autodiscovery" , "aws_enable_s3_autodiscovery" , "aws_allow_s3_access" , "aws_s3_bucket_arn" , "aws_customer_role_arn" }... )
348+ fieldsThatCanChange := append (fieldsThatCanBeUpdated , []string {"aws_enable_eks_autodiscovery" , "aws_enable_rds_autodiscovery" , "aws_enable_redshift_autodiscovery" , "aws_enable_ecs_autodiscovery" , "aws_enable_ec2_autodiscovery" , "aws_enable_s3_autodiscovery" , "aws_allow_s3_access" , "aws_s3_bucket_arn" }... )
337349
338350 if d .HasChangesExcept (fieldsThatCanChange ... ) {
339351 return diag .Errorf ("At the moment you can only update the following fields: %s. If you'd like to update other fields, please message the Formal team and we're happy to help." , strings .Join (fieldsThatCanBeUpdated , ", " ))
0 commit comments