Overview

我们可以通过 AWS provider 来和 AWS 交互,在使用 AWS 前我们需要配置好合适的密钥。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

# Configure the AWS Provider
provider "aws" {
  region = "us-east-1"
}

# Create a VPC
resource "aws_vpc" "example" {
  cidr_block = "10.0.0.0/16"
}

Authentication and Configuration

https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration

ASG

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group

EKS

https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration

Reference