Difference between revisions of "Terraform provider: aws"

From wikieduonline
Jump to navigation Jump to search
 
(107 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs
 
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs
 +
* <code>[[profile]]</code>, <code>[[shared_config_files]]</code>, <code>[[shared_credentials_files]]</code>
  
 +
== Configuration examples ==
 +
{{basic tf aws profile}}
 +
 +
[[provider]] "aws" {
 +
  [[version =]] "~> 3.38.0"
 +
  [[region]] = "[[us-east-1]]"
 +
  [[profile]] = "your_profile_name"
 +
}
 +
 +
provider "aws" {
 +
  region    = [[var.region]]
 +
  version    = ">= 0.13"
 +
  [[assume_role]] {
 +
    [[role_arn]] = "arn:aws:iam::01234567890:role/role_in_account_b"
 +
  }
 +
}
 +
 +
Including Tags:
 +
{{tf_aws_provider_tags}}
 +
 +
[[Dynamic Credentials with the AWS Provider]]:
 +
provider "aws" {
 +
  [[shared_config_files]] = [var.tfc_aws_dynamic_credentials.default.shared_config_file]
 +
}
 +
 +
== Installing ==
 +
Installing hashicorp/aws v4.31.0
 +
Installing [[hashicorp/]]aws v4.29.0...
 +
[[Installing hashicorp]]/aws v4.28.0...
 +
Installing hashicorp/aws v4.15.1...
 +
Installing hashicorp/aws v3.63.0...
 +
 +
== Resources ==
 +
[[Terraform IAM resources]]
 +
 +
[[Networking]]:
 +
* <code>[[aws_vpc]]</code> <ref>https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc</ref>
 +
* <code>[[aws_subnet]]</code>
 +
* <code>[[aws_internet_gateway]]</code>
 +
* <code>[[Terraform: aws_eip|aws_eip]]</code>
 +
 +
[[CloudFront]]
 +
* <code>[[aws_cloudfront_distribution]]</code>
 +
* <code>[[aws_cloudfront_origin_access_identity]]</code>
 +
 +
[[Networking]]
 +
* <code>[[aws_lb]]</code>
 +
* <code>[[terraform resource: aws lb target group|aws_lb_target_group]]</code>
 +
* <code>[[aws_lb_listener]]</code>
 +
* <code>[[aws_lb_listener_rule]]</code>
 +
 +
[[Computing]]:
 
* <code>[[aws_instance]]</code>
 
* <code>[[aws_instance]]</code>
 
* <code>[[aws_key_pair]]</code>
 
* <code>[[aws_key_pair]]</code>
* <code>[[aws_lb]]</code>
+
 
 +
* <code>[[aws_db_instance]]</code>
 +
 
 +
* <code>[[aws_iam_role]]</code>
 +
* <code>[[iam_role_policy]]</code>
 +
 
 
* <code>[[aws_security_group]]</code>
 
* <code>[[aws_security_group]]</code>
* <code>[[terraform resource: aws lb target group|aws_lb_target_group]]</code>
+
* <code>[[aws_appautoscaling_target]]</code> <ref>https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_target</ref>
* <code>[[aws_appautoscaling_target]]</code>
+
* <code>[[aws_appautoscaling_policy]]</code> <ref>https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_policy</ref>
 +
* <code>[[aws_ecs_service]]</code> <ref>https://registry.terraform.io/search/providers?q=aws_ecs_service</ref>
 +
 
 +
[[Terraform RDS resources|RDS]]:
 +
{{tf rds TOC}}
 +
 
 +
[[S3]]:
 +
* <code>[[aws_s3_bucket]]</code>
 +
* <code>[[Terraform resource: aws s3 versioning|aws_s3_versioning]]</code>
 +
* <code>[[aws_s3_bucket_inventory]]</code>
 +
* <code>[[aws_s3_bucket_lifecycle_configuration]]</code>
 +
* <code>[[aws_s3control_bucket_lifecycle_configuration]]</code>
 +
 
 +
[[KMS]]
 +
* <code>[[aws kms key]]</code>
 +
 
 +
[[CloudWatch]]
 +
* <code>[[aws_cloudwatch_metric_alarm]]</code>
 +
* <code>[[aws_cloudwatch_log_group]]</code>
 +
 
 +
[[WAF]]
 +
* <code>[[aws_wafv2_web_acl]]</code>
 +
 
 +
[[Route53]]
 +
* <code>[[aws_route53_record]]</code>
 +
* <code>[[aws_route53_zone]]</code>
 +
 
 +
 
 +
 
 +
[[CodeBuild]]
 +
* <code>[[aws_codebuild_project]]</code>
 +
* <code>[[aws_codebuild_source_credential]]</code>
 +
 
 +
[[CodeDeploy]]
 +
* <code>[[aws_codedeploy_app]]</code>
 +
 
 +
[[ECR]]
 +
* <code>[[aws_ecr_repository]]</code>
 +
 
 +
== Errors ==
 +
* <code>[[Error: Provider produced inconsistent final plan]]</code>
 +
* <code>[[Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.]]</code>
 +
* <code>[[Error: configuring Terraform AWS Provider: failed to get shared config profile]]</code>
 +
* <code>[[AWS Error: A Profile was specified along with the environment variables "AWS ACCESS KEY ID" and "AWS SECRET ACCESS KEY". The Profile is now used instead of the environment variable credentials.]]</code>
 +
 
 +
== Limitation ==
 +
* <code>[[aws account disable-region]]</code> not implemented
 +
 
 +
== Related terms ==
 +
* [[Data sources]]: <code>[[Data source: aws caller identity|aws_caller_identity]]</code>
 +
* [[CloudFormation resource types: (Type:)]]
 +
* [[Terraform S3 backend]]: <code>[[backends.tf]]</code>
 +
* <code>[[providers.tf]]</code>
 +
* [[Terraform provider: AWS]]
 +
* [[AWS Control Tower Account Factory for Terraform (AFT)]]
 +
* [[Terraform AWS data sources]]
 +
* <code>[[AWS_DEFAULT_REGION]]</code>
 +
* [[Terraform modules]]
 +
* [[Terraform provider-level tagging]]
 +
* <code>[[required_version]]</code>
 +
 
 +
== Activities / Changelog ==
 +
* Terraform AWS Provider Version 4 Upgrade Guide: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade
 +
* Terraform AWS provider 4.0: https://www.hashicorp.com/blog/terraform-aws-provider-4-0-refactors-s3-bucket-resource
  
 
== See also ==
 
== See also ==
* {{terraform aws resources}}
+
* {{tf aws}}
 +
* {{terraform providers}}
 +
* {{terraform resources}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]
 
[[Category:AWS]]
 
[[Category:AWS]]

Latest revision as of 17:33, 20 February 2024

Configuration examples[edit]

 provider "aws" {
 profile = "your_profile_name"
}
provider "aws" {
 version = "~> 3.38.0"
 region = "us-east-1"
 profile = "your_profile_name"
}
provider "aws" {
  region     = var.region
  version    = ">= 0.13"
  assume_role {
    role_arn = "arn:aws:iam::01234567890:role/role_in_account_b"
  }
}

Including Tags:

 # Terraform 0.12 (2019) and later syntax
provider "aws" {
  # ... other configuration ...
  default_tags {
    tags = {
      Environment = "Production"
      Owner       = "Ops"
    }
  }
}

Dynamic Credentials with the AWS Provider:

provider "aws" {
  shared_config_files = [var.tfc_aws_dynamic_credentials.default.shared_config_file]
}

Installing[edit]

Installing hashicorp/aws v4.31.0
Installing hashicorp/aws v4.29.0...
Installing hashicorp/aws v4.28.0...
Installing hashicorp/aws v4.15.1...
Installing hashicorp/aws v3.63.0...

Resources[edit]

Terraform IAM resources

Networking:

CloudFront

Networking

Computing:

RDS:

S3:

KMS

CloudWatch

WAF

Route53


CodeBuild

CodeDeploy

ECR

Errors[edit]

Limitation[edit]

Related terms[edit]

Activities / Changelog[edit]

See also[edit]

  • https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc
  • https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_target
  • https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_policy
  • https://registry.terraform.io/search/providers?q=aws_ecs_service
  • Advertising: