Difference between revisions of "Terraform AWS data sources"
Jump to navigation
Jump to search
↑ https://www.hashicorp.com/blog/terraform-aws-provider-4-0-refactors-s3-bucket-resource
(15 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | There is more that 300 AWS data sources <ref>https://www.hashicorp.com/blog/terraform-aws-provider-4-0-refactors-s3-bucket-resource</ref>. | |
− | + | ||
− | + | == AWS data sources == | |
+ | {{tf aws data sources TOC}} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami | ||
+ | [[data]] "[[aws_ami]]" "myexample" { | ||
+ | most_recent = true | ||
+ | |||
+ | owners = ["self"] | ||
+ | tags = { | ||
+ | Name = "app-server" | ||
+ | Tested = "true" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc | ||
+ | [[data]] "[[aws_vpc]]" "selected" { | ||
+ | id = var.[[my_vpc_id]] | ||
+ | } | ||
+ | |||
+ | data "[[template_file]]" "my-secret" { | ||
+ | template = [[aws_iam_access_key]].my_new_user.encrypted_secret | ||
+ | } | ||
== Related terms == | == Related terms == | ||
− | * <code>[[data]]</code> | + | * <code>[[data]]</code>, <code>[[data.]]</code> |
− | * [[Data | + | * [[Terraform: Data sources]]: <code>[[template_file]]</code> |
+ | * [[Terraform AWS provider]] | ||
== See also == | == See also == | ||
* {{terraform aws data sources}} | * {{terraform aws data sources}} | ||
− | * {{ | + | * {{data.}} |
[[Category:Terraform]] | [[Category:Terraform]] |
Latest revision as of 08:30, 24 October 2024
There is more that 300 AWS data sources [1].
AWS data sources[edit]
aws_caller_identity
:data "aws_caller_identity" "current" {}
aws_availability_zones
aws_ami
aws_iam_policy_document
aws_vpc
aws_region
:data "aws_region" "current" {}
aws_subnet
aws_subnet_ids
aws_subnets
aws_s3_bucket
aws_ebs_snapshot
Examples[edit]
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami
data "aws_ami" "myexample" { most_recent = true owners = ["self"] tags = { Name = "app-server" Tested = "true" } }
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc
data "aws_vpc" "selected" { id = var.my_vpc_id }
data "template_file" "my-secret" { template = aws_iam_access_key.my_new_user.encrypted_secret }
Related terms[edit]
See also[edit]
- AWS Data sources:
aws_region
,aws_vpc
,aws_caller_identity
,aws_availability_zones
,aws_eip
,aws_flow_log
,template_file, aws_ami
data., toset, each.
Advertising: