Files
terraform/volcengine/CROSS_ARCHITECTURE.md

95 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 跨架构运行说明
## 支持的架构
此 Terraform 配置支持以下架构:
- Linux AMD64 (x86_64)
- Linux ARM64
- macOS AMD64
- macOS ARM64 (Apple Silicon)
## 本地部署(当前配置)
当前配置使用本地预下载的 provider仅支持 Linux AMD64 架构。如需在其他架构上运行,请按以下步骤操作:
### 1. 删除本地 provider 配置
```bash
# 进入相应目录
cd /path/to/volcengine/personal
# 或
cd /path/to/volcengine/company
# 删除本地 provider 配置
rm -rf .terraform .terraformrc
```
### 2. 下载对应架构的 provider
根据不同架构下载对应的 provider
- AMD64: `terraform-provider-volcengine_v0.0.186_linux_amd64.zip`
- ARM64: `terraform-provider-volcengine_v0.0.186_linux_arm64.zip`
### 3. 配置 provider 路径
创建相应的目录结构并放置 provider 文件:
```bash
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/volcengine/volcengine/0.0.186/<OS>_<ARCH>/
```
### 4. 使用网络下载(推荐)
最简单的方式是允许 Terraform 自动下载适合当前架构的 provider
```bash
# 删除本地配置
rm .terraformrc
# 运行初始化
terraform init
```
Terraform 会自动下载适合当前架构的 provider。
## GitHub Actions 部署示例
```yaml
name: Deploy to VolcEngine
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest # 或 ubuntu-22.04-arm
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.5.0
- name: Initialize Terraform
run: terraform init
- name: Plan
run: terraform plan
- name: Apply
run: terraform apply -auto-approve
```
## 注意事项
1. **认证信息** - 确保在不同环境中正确配置了访问密钥
2. **网络连接** - 确保可以访问火山引擎 API
3. **权限** - 确保有足够的权限创建所需的资源
4. **配额** - 检查目标区域的资源配额