NEW: initial commit

This commit is contained in:
KF 2024-07-26 09:22:47 +08:00
commit 8902c5c43a
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
10 changed files with 92 additions and 0 deletions

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
.idea
### Mac OS ###
.DS_Store
### terraform ###
.terraform
terraform.tfstate
terraform.tfstate.backup
experimental

1
README.md Normal file
View File

@ -0,0 +1 @@
# alicloud terraform examples

11
alicloud-dev.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,20 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/alicloud" {
version = "1.227.1"
hashes = [
"h1:V0JQAnqamfNKXhlZO7Ci5KyBLFBnHAej8DvFJ8PQpZc=",
"zh:15b5c4fe3bec5fb97606e7143a8cfd346529bcc9b51c0d0f29aac98d47bd4504",
"zh:3a8e666eed369e9b51a967f76126c6106f2594241709b7085d0f22d2cec1695b",
"zh:410b52b99bbb8dbc3fe8ac247dcd752e7418a359570e8f7d33d0002f73e1ba24",
"zh:6325cee8f418712933ef531084defe2f2a5f1571e483de4e2b8dd8c879b86166",
"zh:8b9213c763b019043293dd5b34c8fdf9c6267f130eadda3513cedcacda2bd168",
"zh:c2041fc4cda4475338ee55c27687d391f6363d8fb2b5301945a331639aea7cf5",
"zh:ccb1029e07c5c84a03d29f481a18efcfc2b590647361f2623a312114fe615a2f",
"zh:d55eaa08f5a06481ecbe44661bffc58b60f6d82c502ed4cf813d6849e5946eac",
"zh:eade88066e2ff112b616aca564d6e0b4d45a4cf3103d2cbf90f2c91c21cb357a",
"zh:f035cb6992d292928e087ddf4b0c6e232ed6b04e1bf1372e38e027d6648078f8",
"zh:fae90ca83ccf3ea074aa5a611a5d12388c75d4393b2bd9da408b3f37197fe9c3",
]
}

View File

@ -0,0 +1,8 @@
resource "alicloud_vpc" "vpc" {
vpc_name = var.vpc-name
description = var.vpc-description
cidr_block = var.vpc-cidr
is_default = true
enable_ipv6 = false
tags = local.tags
}

View File

@ -0,0 +1,3 @@
output "vpc-id" {
value = alicloud_vpc.vpc.id
}

View File

@ -0,0 +1,12 @@
/* Authentication
Use environment variables
$ export ALICLOUD_ACCESS_KEY="<Your-Access-Key-ID>"
$ export ALICLOUD_SECRET_KEY="<Your-Access-Key-Secret>"
$ export ALICLOUD_REGION="cn-beijing"
Or instance role
ecs_role_name = "terraform-provider-alicloud"
*/
provider "alicloud" {
region = "cn-hongkong"
}

View File

@ -0,0 +1,6 @@
locals {
tags = {
Owner = "xpk"
TerraformDir = join("/", reverse(slice(reverse(split("/", path.cwd)), 0, 2)))
}
}

View File

@ -0,0 +1,3 @@
vpc-name = "DefaultVpc"
vpc-description = "Default Vpc"
vpc-cidr = "172.16.0.0/16"

View File

@ -0,0 +1,14 @@
variable vpc-name {
type = string
description = "Name of VPC"
}
variable vpc-description {
type = string
description = "Description of VPC"
}
variable vpc-cidr {
type = string
description = "CIDR of VPC"
}