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
Line 8: | Line 8: | ||
* <code>[[Terraform data source: aws_vpc|aws_vpc]]</code> | * <code>[[Terraform data source: aws_vpc|aws_vpc]]</code> | ||
* <code>[[Terraform data source: aws_region|aws_region]]</code> | * <code>[[Terraform data source: aws_region|aws_region]]</code> | ||
+ | |||
+ | == 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 == |
Revision as of 13:52, 31 January 2023
There is more that 300 AWS data sources [1].
AWS data sources
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
See also
- AWS Data sources:
aws_region
,aws_vpc
,aws_caller_identity
,aws_availability_zones
,aws_eip
,aws_flow_log
,template_file, aws_ami
- Terraform AWS resources: IAM, Net, EC2, ECS, ECR, S3, Route53, ACM, CloudWatch, CloudFront SES, RDS, DLM
Advertising: