Terraform
HashiCorp Terraform Provider
Example Usage
terraform {
required_providers {
hava = {
source = "teamhava/hava"
version = "~> 0.1"
}
aws = {
source = "hashicorp/aws"
version = "~> 4.39"
}
}
}
// Get the ARN for the AWS Read Only Managed Policy
data "aws_iam_policy" "example" {
name = "ReadOnlyAccess"
}
// Create the role that will be used for cross account role accesss
resource "aws_iam_role" "hava_ro" {
name = "hava-read-only-role"
assume_role_policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
// Hava CAR account
"AWS": "arn:aws:iam::281013829959:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
// unique id for your Hava account,
"sts:ExternalId": var.external_id
}
}
}
]
})
managed_policy_arns = [data.aws_iam_policy.example.arn]
}
//
resource "hava_source_aws_car_resource" "example" {
name = "Example Source"
role_arn = aws_iam_role.hava_ro.arn
external_id = var.external_id
}Authentication
Last updated
Was this helpful?
