Hi,
If I may ask - I would like some information for aws_imagebuilder_image_recipe
:
(I want to build an image pipeline)
this is the code of my image pipeline (the beginning):
module "s3" {
source = "../modules/s3_bucket/bucket"
name = "${local.bucket_name}"
key_alias = var.key_alias
}
module "networing" {
source = "../Net"
}
data "aws_ecr_image" "service_image" {
repository_name = "image"
image_tag = "latest"
}
resource "aws_imagebuilder_component" "example" {
data = yamlencode({
phases = [{
name = "build"
steps = [{
action = "ExecuteBash"
inputs = {
commands = ["echo 'hello world'"]
}
name = "example"
onFailure = "Continue"
}]
}]
schemaVersion = 1.0
})
name = "example"
platform = "Linux"
version = "1.0.0"
}
resource "aws_imagebuilder_image_recipe" "example" {
component {
# component_arn = "arn:aws:imagebuilder:eu-west-2:aws:component/docker-ce-linux/x.x.x",
component_arn = aws_imagebuilder_component.example.arn
}
name = "example1"
parent_image = "ami-0b3077aa5fb5d0d00"
version = "1.0.0"
}
resource "aws_iam_instance_profile" "test_profile" {
name = "test_profile"
role = aws_iam_role.role.name
}
resource "aws_iam_role" "role" {
name = "test_role"
path = "/"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_key_pair" "deployer" {
key_name = "deployer-key"
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"
}
resource "aws_sns_topic" "user_updates" {
name = "user-updates-topic"
}
resource "aws_imagebuilder_infrastructure_configuration" "imagebuilder_conf_jenkins" {
description = "aws imagebuilder infrastructure configuration for image pipeline"
instance_profile_name = aws_iam_instance_profile.test_profile.name
instance_types = ["t2.nano", "t3.micro"]
key_pair = aws_key_pair.deployer.key_name
name = "jenkins_imagebuilder_infrastructure_configuration"
security_group_ids = [module.networing.security_group_id]
sns_topic_arn = aws_sns_topic.user_updates.arn
subnet_id = module.networing.public_sub_b
terminate_instance_on_failure = true
logging {
s3_logs {
s3_bucket_name = module.s3.bucket_domain_name
s3_key_prefix = "logs"
}
}
tags = {
foo = "bar"
}
}
resource "aws_imagebuilder_image_pipeline" "jk_image_builder" {
image_recipe_arn = aws_imagebuilder_image_recipe.example.arn
infrastructure_configuration_arn = aws_imagebuilder_infrastructure_configuration.imagebuilder_conf_jenkins.arn
name = "jk_image_builder"
}
I want to add the Dockerfile to Recipe (as in the images below)
thanks