Resource: aws_rolesanywhere_trust_anchor

Terraform resource for managing a Roles Anywhere Trust Anchor.

Example Usage

resource "aws_acmpca_certificate_authority" "example" {
  permanent_deletion_time_in_days = 7
  type                            = "ROOT"
  certificate_authority_configuration {
    key_algorithm     = "RSA_4096"
    signing_algorithm = "SHA512WITHRSA"
    subject {
      common_name = "example.com"
    }
  }
}

data "aws_partition" "current" {}

resource "aws_acmpca_certificate" "test" {
  certificate_authority_arn   = aws_acmpca_certificate_authority.example.arn
  certificate_signing_request = aws_acmpca_certificate_authority.example.certificate_signing_request
  signing_algorithm           = "SHA512WITHRSA"

  template_arn = "arn:${data.aws_partition.current.partition}:acm-pca:::template/RootCACertificate/V1"

  validity {
    type  = "YEARS"
    value = 1
  }
}

resource "aws_acmpca_certificate_authority_certificate" "example" {
  certificate_authority_arn = aws_acmpca_certificate_authority.example.arn
  certificate               = aws_acmpca_certificate.example.certificate
  certificate_chain         = aws_acmpca_certificate.example.certificate_chain
}

resource "aws_rolesanywhere_trust_anchor" "test" {
  name = "example"
  source {
    source_data {
      acm_pca_arn = aws_acmpca_certificate_authority.example.arn
    }
    source_type = "AWS_ACM_PCA"
  }
  # Wait for the ACMPCA to be ready to receive requests before setting up the trust anchor
  depends_on = [aws_acmpca_certificate_authority_certificate.example]
}

Argument Reference

This resource supports the following arguments:

Nested Blocks

source

source_data

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_rolesanywhere_trust_anchor using its id. For example:

import {
  to = aws_rolesanywhere_trust_anchor.example
  id = "92b2fbbb-984d-41a3-a765-e3cbdb69ebb1"
}

Using terraform import, import aws_rolesanywhere_trust_anchor using its id. For example:

% terraform import aws_rolesanywhere_trust_anchor.example 92b2fbbb-984d-41a3-a765-e3cbdb69ebb1