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
| xg-debian@debian:~/terraform-example$ terraform plan | |
| Refreshing Terraform state in-memory prior to plan... | |
| The refreshed state will be used to calculate this plan, but will not be | |
| persisted to local or remote state storage. | |
| ------------------------------------------------------------------------ | |
| An execution plan has been generated and is shown below. | |
| Resource actions are indicated with the following symbols: |
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
| xg@debian:~/terraform$ terraform init | |
| Initializing the backend... | |
| Initializing provider plugins... | |
| - Checking for available provider plugins... | |
| - Downloading plugin for provider "aws" (hashicorp/aws) 2.49.0... | |
| The following providers do not have any version constraints in configuration, | |
| so the latest version was installed. |
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 "google_storage_bucket" "bucket" { | |
| name = "my-bucket-on-gcp" | |
| location = "EU" | |
| website { | |
| main_page_suffix = "index.html" | |
| not_found_page = "404.html" | |
| } | |
| } |
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_s3_bucket" "bucket" { | |
| bucket = "my-bucket-on-aws" | |
| acl = "public-read" | |
| policy = "${file("bucketpolicy.json")}" | |
| website { | |
| index_document = "index.html" | |
| error_document = "error.html" | |
| } | |
| } |
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 "bastion-ip" { | |
| value = aws_instance.my-ec2-bastion.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
| tags = { | |
| Name = "my-resource-name-${var.profile}" | |
| } |
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
| #Nom de profil AWS | |
| variable "profile" { | |
| #Valeur par défaut | |
| default = "default" | |
| } | |
| variable "ip" { | |
| #Sans valeur par défaut | |
| } |
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_s3_bucket" "my-bucket-example" { | |
| bucket = "my-bucket-example-23413426676567" | |
| acl = "public-read" | |
| } | |
| resource "aws_s3_bucket_object" "picture-of-cat" { | |
| bucket = aws_s3_bucket.my-bucket-example.id | |
| key = "cat.jpg" | |
| acl = "public-read" |
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
| provider "aws" { | |
| profile = "altaccount" | |
| region = "eu-west-1" | |
| } |
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
| #Créer une paire de clés dans terraform requiert d'utiliser sa clé publique comme matériel. Il est | |
| #recommandé d'utiliser `$ ssh-keygen -t rsa` pour en créer une et la remplacer ici. | |
| resource "aws_key_pair" "my-key" { | |
| key_name = "my-key" | |
| public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUNl0PHsE9is7/PB0OilYBt3gUuQOlS4DM1jtN+WVP8DsgufiUWdbIFtKX0Q4P/tvkez5r7XVHOSDPliswatHisDK5aNCjW20VGI1Tf0lljoLVoIHSZgHPgj7L+3v40vLCkrMojpc9c6S5KH2fRh8qKDhMe9Qnw197WSFwItRNq4PsKHZvQQuZIkoolzfp4OwM7rkcazLfD3GW2JWo95Ut/Pw+L0tjx478+7KIsHoz4uyT1N7Lc90rb6EY/d3J1grvgWm82/mAZnFmPVEurnNsMIOAmh+Bv3yhYJQdNFX7mHln6/JFo3ei2tFVna3Yv0sOpnn2+2wlatUMwD8t7+TP example@example" | |
| } | |
| #Permet de déclarer un group de sécurité pour EC2, sans quoi il ne sera pas possible d'y accéder | |
| resource "aws_security_group" "my-security-group" { | |
| #Il est nécessaire de nommer le security group, mais optionnel de lui donner une description |
NewerOlder