«   2021/04   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
04-16 16:02
Notice
Today
202
Total
1,418,505
관리 메뉴

변군이글루

[terraformA 시리즈] provider 생성 본문

* 퍼블릭 클라우드

[terraformA 시리즈] provider 생성

변군 변군이글루 2021. 1. 29. 19:21

terraform provider 생성

~/.aws/credentials 확인

$ vim ~/.aws/credentials
[terraformA]
aws_access_key_id = AWSACCESSKEYID
aws_secret_access_key = AWSSECRETACCESSKEY

~/.aws/config 확인

$ vim ~/.aws/config
[terraformA]
region = us-east-1

디렉토리 생성

$ mkdir -p terraformA/aws/serviceA/us-east-1

provider.tf 파일 생성

$ vim provider.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.25.0"
    }
  }
}

provider "aws" {
  # Configuration options
  shared_credentials_file = "~/.aws/credentials"
  region  = "us-east-1"
  profile = "terraformA"
}

terraform init 명령 실행

$ terraform init

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Installing hashicorp/aws v3.25.0...
- Installed hashicorp/aws v3.25.0 (signed by HashiCorp)

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

 

https://learn.hashicorp.com/tutorials/terraform/aws-remote?in=terraform/aws-get-started

 

Store Remote State | Terraform - HashiCorp Learn

Configure Terraform to store state in Terraform Cloud remote backend. Add a remote state block directly to configuration or set an environment variable to load remote state configuration when Terraform initializes.

learn.hashicorp.com

 

 

0 Comments
댓글쓰기 폼