mirror of
				https://github.com/nmasur/dotfiles
				synced 2025-11-04 04:43:15 +00:00 
			
		
		
		
	use terraform_data to fix data-based replacement
This commit is contained in:
		@@ -12,9 +12,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Use existing image in S3
 | 
					# Use existing image in S3
 | 
				
			||||||
data "aws_s3_object" "image" {
 | 
					data "aws_s3_object" "image" {
 | 
				
			||||||
  bucket        = var.images_bucket
 | 
					  bucket = var.images_bucket
 | 
				
			||||||
  key           = "arrow.vhd"
 | 
					  key    = "arrow.vhd"
 | 
				
			||||||
  checksum_mode = "ENABLED"
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					resource "terraform_data" "image_replacement" {
 | 
				
			||||||
 | 
					  input = data.aws_s3_object.image.checksum_sha256
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Setup IAM access for the VM Importer
 | 
					# Setup IAM access for the VM Importer
 | 
				
			||||||
@@ -72,7 +75,7 @@ resource "aws_ebs_snapshot_import" "image" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  role_name = aws_iam_role.vmimport.name
 | 
					  role_name = aws_iam_role.vmimport.name
 | 
				
			||||||
  lifecycle {
 | 
					  lifecycle {
 | 
				
			||||||
    replace_triggered_by = [data.aws_s3_object.image.checksum_sha256]
 | 
					    replace_triggered_by = [terraform_data.image_replacement]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user