mirror of
https://github.com/ghndrx/cloud-init.git
synced 2026-02-10 06:44:57 +00:00
modify each file and add a commit message
```
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# BEGIN: cloud-init.yaml
|
||||
#cloud-config
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
@@ -19,10 +18,13 @@ users:
|
||||
shell: /bin/bash
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCdOF80z0piQEnYzNCu2OGvOJdm7+3wfDuiC+Jzi8VbSC5VW4iJAQXOuDNGLzyqNi6uMjI77xpEL6Xzn29uJiQti6Y/LxhOZwNNIQiGUpFco1wkBYeBFbtgHQxsMLwumrxQGEj2fyCiSrACAPyy/l1fP4mlN7abBGD5aozBrYKxXPS/kfwO5nsWmw27RgTzfHJzie2dUU3ew/kd7td3wEdWrRXq8wNbu+yvAyiog54huUUWmYZwY3QVwXr6R1wsVudawM6BEl45QFq+hdB4t83azHG94XLy2NCAncohdU7zP40nsbvIDyh+4wIKeU90z6TLrXfHUYuBT6/ky7qOFm/Ym1QG4zCDz3jin8Qoa31PGaObzj/zoMJXgOXKcp16W0j9SZAenvnSfuWUEfBR1yBRR0T5Wg5v1vi7KGBTATaz8el802uliL+yZbGtMbNpAPGR5nK5C4yorf8yVYvIgo/LJaWCDND2O1e2mdut1WyRmvIwMnq7PFZT8zAsgGXfhDM= greg@ligma
|
||||
lock_passwd: false
|
||||
ssh_pwauth: false
|
||||
chpasswd:
|
||||
expire: false
|
||||
|
||||
runcmd:
|
||||
- INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
|
||||
AVAILABILITY_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
|
||||
HOSTNAME="$INSTANCE_ID-$AVAILABILITY_ZONE"
|
||||
hostnamectl set-hostname $HOSTNAME
|
||||
# END: cloud-init.yaml
|
||||
- AVAILABILITY_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
|
||||
- HOSTNAME="$INSTANCE_ID-$AVAILABILITY_ZONE"
|
||||
- hostnamectl set-hostname $HOSTNAME
|
||||
|
||||
@@ -4,16 +4,16 @@ provider "aws" {
|
||||
}
|
||||
|
||||
resource "aws_instance" "example" {
|
||||
ami = "ami-0c94855ba95c71c99" # Ubuntu 20.04 LTS
|
||||
ami = "ami-06aa3f7caf3a30282" # Ubuntu 20.04 LTS
|
||||
instance_type = "t2.micro"
|
||||
associate_public_ip_address = true
|
||||
|
||||
security_groups = [aws_security_group.example_sg]
|
||||
root_block_device {
|
||||
volume_size = 50
|
||||
volume_type = "gp2"
|
||||
}
|
||||
|
||||
user_data = file("${path.module}/ubuntu-init.yaml")
|
||||
user_data = base64encode(file("${path.module}/ubuntu-init.yaml"))
|
||||
|
||||
tags = {
|
||||
Name = "cloud-init-example"
|
||||
@@ -32,10 +32,3 @@ resource "aws_security_group" "example_sg" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_security_group" "example_sg" {
|
||||
ingress {
|
||||
from_port = 22
|
||||
to_port = 22
|
||||
protocol = "tcp"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user