This file contains hidden or 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 "app_region" { | |
description = "what instance type I can use" | |
type = string | |
} | |
variable "ami" { | |
description = "what subnet_id I can use" | |
type = string | |
} |
This file contains hidden or 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 "app_region" { | |
description = "what instance type I can use" | |
type = string | |
} | |
variable "ami" { | |
description = "what subnet_id I can use" | |
type = string | |
} |
This file contains hidden or 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 "app_region" { | |
description = "what instance type I can use" | |
type = string | |
} | |
variable "ami" { | |
description = "what subnet_id I can use" | |
type = string | |
} |
This file contains hidden or 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
locals { | |
vpc_id = var.vpc_id | |
subnet_id = var.subnet_id | |
ssh_user = var.ssh_user | |
key_name = var.key_name | |
private_key_path = var.private_key_path | |
} | |
resource "aws_instance" "gitlab" { | |
ami = "ami-04505e74c0741db5a" |
This file contains hidden or 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.0" | |
} | |
} | |
} |
This file contains hidden or 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" "server" { | |
name = "server_access" | |
vpc_id = local.vpc_id | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} |
This file contains hidden or 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
# tree projects/ | |
projects/ | |
├── modules | |
│ └── gitLab_app | |
│ ├── ec2.tf | |
│ ├── output.tf | |
│ ├── security_group.tf | |
│ ├── variables.tf | |
│ └── versions.tf | |
├── sa_gitLab_app |
This file contains hidden or 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
output "server_ip" { | |
value = aws_instance.server.public_ip | |
} |
This file contains hidden or 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: my playbook | |
hosts: all | |
become: true | |
remote_user: ubuntu | |
gather_facts: false | |
tasks: | |
- name: Update all packages to their latest version | |
apt: | |
upgrade: yes |
This file contains hidden or 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: my playbook | |
hosts: all | |
become: true | |
remote_user: ubuntu | |
gather_facts: false | |
tasks: | |
- name: Update all packages to their latest version | |
apt: | |
upgrade: yes |