Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform install for cloud provider #515

Open
1 of 4 tasks
chendelin1982 opened this issue Jul 20, 2024 · 6 comments
Open
1 of 4 tasks

Terraform install for cloud provider #515

chendelin1982 opened this issue Jul 20, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request S-research Stage label, on reseaching

Comments

@chendelin1982
Copy link
Contributor

chendelin1982 commented Jul 20, 2024

What type of your feature request?

Terraform template for major cloud provider

  • azure
  • aws
  • alibabacloud
  • huweicloud
@chendelin1982 chendelin1982 added the enhancement New feature or request label Jul 20, 2024
@chendelin1982
Copy link
Contributor Author

chendelin1982 commented Dec 23, 2024

  1. buy websoft9 image
  2. delivery a .tf file
  3. VM selection

@chendelin1982 chendelin1982 added the S-research Stage label, on reseaching label Dec 23, 2024
@zhaojing1987
Copy link
Contributor

Terraform Manage AWS Services

@zhaojing1987
Copy link
Contributor

zhaojing1987 commented Jan 9, 2025

在AWS的CloudShell测试步骤如下(需要确保当前用户权限):

  1. 安装 Terraform (CloudShell默认使用Amazon Linux)
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
sudo yum -y install terraform
terraform -install-autocomplete
  1. 编辑代码main.tf
terraform {
 required_version = ">= 1.4.0"
 required_providers {
   aws = {
     source  = "hashicorp/aws"
     version = ">= 5.0.0"
   }
 }
}

provider "aws" {
 region = "us-east-1"   #区域
}

resource "aws_instance" "example" {                  # 资源名称
 ami             = "ami-06409e015d6e1bf5c"        # Websoft9 平台的AMI
 instance_type   = "t2.micro"                            # 实例类型
 key_name        = "websoft9_auto"                  # 密钥对名称
 vpc_security_group_ids = ["sg-1240356f"]     # 安全组ID
 tags = {                                                           # 标签
     Name = "Websoft9  Platform"
   }
}

3.相关命令

初始化:terraform init
应用:terraform apply

释放:terraform destroy

格式化:terraform fmt        
检测:terraform validate    
状态:terraform show

Tips:CloudShell 退出后,Terraform 也会随之销毁,下次又需要重新安装,但是相关源码还在

@chendelin1982
Copy link
Contributor Author

imageid 是否与地区有关

@zhaojing1987
Copy link
Contributor

区域不同 ,imageid 不同,查询命令:

aws ec2 describe-images \
    --filters "Name=product-code,Values=<商品代码>" \
    --region <区域>

例如:

aws ec2 describe-images \
    --filters "Name=product-code,Values=e5khuz6bgm3khfdzxa1q9fs99" \
    --region us-east-1

@chendelin1982
Copy link
Contributor Author

add to docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request S-research Stage label, on reseaching
Projects
None yet
Development

No branches or pull requests

3 participants