- HCL 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| tests | ||
| .copywrite.hcl | ||
| .gitignore | ||
| config.tf | ||
| LICENSE | ||
| locals.tf | ||
| main.tf | ||
| outputs.tf | ||
| README.md | ||
| variables.tf | ||
Terraform Infragraph AWS Connector Module
This module creates the AWS IAM resources needed for HCP Infragraph to authenticate with AWS through OIDC and read supported AWS resources.
What This Module Creates
- An
aws_iam_openid_connect_providerfor the HCP Infragraph OIDC issuer - An
aws_iam_roletrusted by that OIDC provider - A resource access policy built from the recommended AWS permission sets in
locals.tf - A policy attachment that attaches the resource access policy to the role
Usage
module "infragraph_aws_connector" {
source = "hashicorp/infragraph-connector-permissions/aws"
oidc_provider_url = "https://<your-hcp-oidc-provider-url>"
}
After terraform apply, use the exported role_arn or role_name when configuring the AWS connector in HCP Infragraph.
Optional Naming Configuration
You can override aws_iam_role_name. The module derives the IAM policy name from that value by trimming a trailing -role and appending the policy-specific suffix.
module "infragraph_aws_connector" {
source = "hashicorp/infragraph-connector-permissions/aws"
oidc_provider_url = "https://<your-hcp-oidc-provider-url>"
aws_iam_role_name = "my-team-infragraph-role"
}
This produces:
- IAM role:
my-team-infragraph-role - Resource access policy:
my-team-infragraph-resource-policy
If aws_iam_role_name does not end with -role, the full value is used as-is before -resource-policy is appended.
Installed AWS Permission Groups
The generated resource access policy includes these permission groups:
accountautoscalingcloudformationcloudwatchdynamodbec2ecsekselasticfilesystemelasticloadbalancingiamlambdamanaged-fleetsorganizationsrdsroute53s3secretsmanagersnssqs
Inputs
oidc_provider_url: Required. HCP OIDC provider URL for your organization.aws_iam_role_name: Optional. Defaults tohcp_infragraph-role. The module derivesaws_iam_resource_access_policy_namefrom this value by trimming a trailing-roleand appending-resource-policy.hcp_infragraph_subject: Optional. Exact OIDCsubclaim value the assumed token must match, enforced withStringEqualsin the role trust policy. Pin this to the HCP Infragraph connector workload identity to isolate the role from any other workload sharing the same OIDC issuer and audience within your HCP organization. Leave empty to skip thesubcondition.
Outputs
role_arnrole_name
Where The AWS Permissions Live
The source of truth for the installed AWS resource permissions is locals.tf.
local.permission_setscontains the action lists, grouped by AWS service or feature area.local.enabled_actionsflattens those groups into the final action list.local.aws_iam_resource_access_policy_namederives the policy name fromaws_iam_role_name.main.tfuses those locals to build and attach the resource access policy.
The role itself is assumed via sts:AssumeRoleWithWebIdentity, governed by the OIDC trust policy on main.tf. That assumption is authorized entirely by the role trust policy and OIDC token validation, so no identity policy granting that action is required or created.
If you need the exact AWS actions this module installs, open locals.tf and review local.permission_sets.