github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/avd_docs/aws/ec2/AVD-AWS-0029/Terraform.md (about)

     1  
     2  Remove sensitive data from the EC2 instance user-data
     3  
     4  ```hcl
     5   resource "aws_iam_instance_profile" "good_example" {
     6  		 // ...
     7   }
     8   
     9   resource "aws_instance" "good_example" {
    10  	 ami           = "ami-12345667"
    11  	 instance_type = "t2.small"
    12   
    13  	 iam_instance_profile = aws_iam_instance_profile.good_profile.arn
    14   
    15  	 user_data = <<EOF
    16  	 export GREETING=hello
    17   EOF
    18   }
    19   
    20  ```
    21  
    22  #### Remediation Links
    23   - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#user_data
    24