Created
February 2, 2023 14:34
-
-
Save theCaptN21/6192d04e9fd93ff0136af5286881f3dd to your computer and use it in GitHub Desktop.
Jenkins instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Jenkins instance | |
resource "aws_instance" "jenkins_server" { | |
ami = "data.aws_ami.linux.id" | |
instance_type = "t2.micro" | |
vpc_security_group_ids = [aws_security_group.jenkins_sg.id] | |
tags = { | |
Name = "Jenkins Server" | |
} | |
iam_instance_profile = "${aws_iam_role.jenkins_role.name}" | |
user_data = <<EOF | |
#!/bin/bash | |
yum update -y | |
yum install -y java-1.8.0-openjdk | |
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo | |
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key | |
yum install -y jenkins | |
systemctl start jenkins | |
systemctl enable jenkins | |
EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment