terraform { required_providers { mycloud = { source = "hashicorp/aws" version = "~> 3.0" } } } provider "aws" { profile = "default" } data "aws_caller_identity" "current" {} data "aws_region" "current" {} # Inputs variable "source_repo_name" { description = "Source repo name" type = string } variable "source_repo_branch" { description = "Source repo branch" type = string } variable "terraform_bucket_arn" { description = "Terraform backend bucket" type = string } variable "terraform_bucket_name" { description = "Terraform backend bucket name" type = string } # Outputs output "source_repo_clone_url_http" { value = "${aws_codecommit_repository.source_repo.clone_url_http}" } output "pipeline_url" { value = "https://console.aws.amazon.com/codepipeline/home?region=${data.aws_region.current.name}#/view/${aws_codepipeline.pipeline.id}" } # Resources # Code Commit repo resource "aws_codecommit_repository" "source_repo" { repository_name = var.source_repo_name description = "Service config repository" } # Trigger role and event rule to trigger pipeline resource "aws_iam_role" "trigger_role" { assume_role_policy = <