NEW: Exercise1

This commit is contained in:
KF 2024-05-30 14:18:55 +08:00
parent 1e9b274965
commit 6b0107c3b1
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
9 changed files with 63 additions and 0 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ bin/
### Terraform ###
.terraform
*.tfstate
*.tfstate.backup

View File

@ -0,0 +1 @@
cidr_block = "10.0.0.0/8"

View File

@ -0,0 +1,6 @@
variable "cidr_block" {
type = string
description = "CIDR block of VPC"
default = "10.0.0.0/16"
}

View File

@ -0,0 +1,17 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.51.1"
constraints = ">= 5.0.0"
hashes = [
"h1:ESfxP2tCO6IZldSQnepXmIm+x+VtaQt/bKgGjYE+0BY=",
]
}
provider "registry.terraform.io/hashicorp/random" {
version = "3.6.2"
hashes = [
"h1:wmG0QFjQ2OfyPy6BB7mQ57WtoZZGGV07uAPQeDmIrAE=",
]
}

View File

@ -0,0 +1,6 @@
resource "aws_iam_group" "Group1" {
name = "Team-${random_pet.this.id}"
path = "/users/"
}
resource "random_pet" "this" {}

View File

@ -0,0 +1,4 @@
output "GroupName" {
value = aws_iam_group.Group1.name
description = "Name of IAM group"
}

View File

@ -0,0 +1,27 @@
provider "aws" {
region = "ap-east-1"
default_tags {
tags = {
ServiceProvider = "RackspaceTechnology"
Environment = "Training"
Project = "Iac"
TerraformMode = "managed"
TerraformDir = "${reverse(split("/", path.cwd))[1]}/${reverse(split("/", path.cwd))[0]}"
}
}
}
output "last-updated" {
value = timestamp()
}
terraform {
required_version = ">= 1.3.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0"
}
}
}