provider "scaleway" {
region = "ams1"
}
data "scaleway_bootscript" "latest" {
architecture = "x86_64"
name_filter = "latest"
}
data "scaleway_image" "alpine" {
architecture = "x86_64"
name = "Alpine Linux"
}
resource "scaleway_ip" "example_ip" {
server = "${scaleway_server.example.id}"
}
resource "scaleway_server" "example" {
name = "example.changeme.net"
image = "${data.scaleway_image.alpine.id}"
type = "VC1S"
bootscript = "${data.scaleway_bootscript.latest.id}"
security_group = "${scaleway_security_group.example_default.id}"
}
resource "scaleway_security_group" "example_default" {
name = "example_default"
description = "Allow SSH traffic"
}
resource "scaleway_security_group_rule" "ssh_accept" {
security_group = "${scaleway_security_group.example_default.id}"
action = "accept"
direction = "inbound"
ip_range = "0.0.0.0/0"
protocol = "TCP"
port = 22
}
Once done, exit the file and run the following:
$ terraform fmt
This command will let you know of any problems with your file.
If it detects incorrect syntax, it will attempt to tell you of the problem, such as in the below example:
$ terraform fmt
Error running fmt: In main.tf: At 3:2: expected: IDENT | STRING | ASSIGN | LBRACE got: RBRACE
If it detects formatting that strays from Terraform’s ideal, it will fix it, and print out the name of the file it corrected, as seen below:
$ terraform fmt
main.tf
No comments:
Post a Comment