Skip to content

Instantly share code, notes, and snippets.

@amzar96
Created September 14, 2023 18:18
Show Gist options
  • Save amzar96/7c53f5368da1cf1765ec85f542249c94 to your computer and use it in GitHub Desktop.
Save amzar96/7c53f5368da1cf1765ec85f542249c94 to your computer and use it in GitHub Desktop.
Terraform - S3 Creation
terraform {
cloud {
organization = "xxxx"
workspaces {
name = "s3-creation"
}
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.16.0"
}
}
required_version = ">= 1.1.0"
}
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.region
}
data "aws_iam_policy_document" "assume_role" {
statement {
effect = "Allow"
principals {
type = "Service"
identifiers = ["s3.amazonaws.com"]
}
actions = ["sts:AssumeRole"]
}
}
resource "aws_s3_bucket" "zar-tf" {
bucket = "zar-tf-bucket"
tags = {
Name = "Zars bucket"
Environment = "Dev"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment