From 2dd02c8f3cd486cf721a235b6d22edd4e0ddf1ca Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Thu, 30 Mar 2023 16:29:03 +0300 Subject: [PATCH] haifa reminder ec2 --- .gitignore | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 7 +++++++ haifa-reminder-vars.tf | 17 +++++++++++++++++ main.tf | 16 ++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 haifa-reminder-vars.tf create mode 100644 main.tf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f262651 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# ---> Terraform +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json +*keys-vars.tf +keys +*.terraform.lock.hcl + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +.terraform.lock.hcl +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + diff --git a/README.md b/README.md new file mode 100644 index 0000000..0fc828a --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# kfir-infrastructure-terraform + +My developing infrastructure. + + +Projects - + EC2 For haifa-reminder app \ No newline at end of file diff --git a/haifa-reminder-vars.tf b/haifa-reminder-vars.tf new file mode 100644 index 0000000..e7e04d6 --- /dev/null +++ b/haifa-reminder-vars.tf @@ -0,0 +1,17 @@ +variable "instance_type" { + type = string + default = "t2.micro" + description = "EC2 instance type" +} + +variable "region" { + type = string + default = "eu-central-1" + description = "AWS region" +} + +variable "ami" { + type = string + default = "ami-0ec7f9846da6b0f61" + description = "AMI ID" +} \ No newline at end of file diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..82f1cc2 --- /dev/null +++ b/main.tf @@ -0,0 +1,16 @@ +# Path: vars/haifa-reminder.tf + +provider "aws" { + region = var.region +} + +// create a new EC2 instance named "haifa-reminder" +resource "aws_instance" "haifa-reminder" { + ami = var.ami + instance_type = var.instance_type + tags = { + Name = "haifa-reminder" + } + ## SSH key name ## + key_name = var.terraform_key_name +}