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
name: "Terraform" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
terraform: |
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
resource "aws_key_pair" "deployer" { | |
key_name = "ec2-deployer-key-pair" | |
public_key = "your public_key look like that ssh-rsa AAAAB3N…” | |
} |
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
resource "aws_security_group" "main" { | |
egress = [ | |
{ | |
cidr_blocks = ["0.0.0.0/0", ] | |
description = "" | |
from_port = 0 | |
ipv6_cidr_blocks = [] | |
prefix_list_ids = [] | |
protocol = "-1" | |
security_groups = [] |
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
resource "aws_instance" "app_server" { | |
count = 2 | |
ami = "ami-047e03b8591f2d48a" | |
instance_type = "t2.micro" | |
key_name = "ec2-deployer-key-pair" | |
vpc_security_group_ids = [aws_security_group.main.id] | |
tags = { | |
Name = "First-Ec2-With-Terraform" | |
} |
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
variable "AWS_ACCESS_KEY_ID" { | |
type = string | |
} | |
variable "AWS_SECRET_ACCESS_KEY" { | |
type = string | |
} |
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
provider "aws" { | |
profile = "default" | |
region = "eu-central-1" | |
access_key = var.AWS_ACCESS_KEY_ID | |
secret_key = var.AWS_SECRET_ACCESS_KEY | |
} |
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
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = "~> 3.27" | |
} | |
} | |
required_version = ">= 1.0.4" | |
} |
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
Enclosed you see the process to this request: |
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
http http://hostname/resource |
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
curl -i -H "Accept: application/json" -X GET http://hostname/resource |
NewerOlder