diff --git a/.gitignore b/.gitignore index 7bfac46..bca074a 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,9 @@ terraform.rc # MacOS files .DS_Store + +# These lines were added by the tf-migrate CLI tool +.terraform.lock.* +_hcp-migrate-configs/ +_hcp-migrate-configs-*/ +!_hcp-migrate-configs*/terraform.tfstate diff --git a/_hcp-migrate-configs/terraform.tfstate b/_hcp-migrate-configs/terraform.tfstate new file mode 100644 index 0000000..b82fbff --- /dev/null +++ b/_hcp-migrate-configs/terraform.tfstate @@ -0,0 +1,518 @@ +{ + "version": 4, + "terraform_version": "1.10.5", + "serial": 14, + "lineage": "14b34381-9375-4d84-89fb-378aef4cb602", + "outputs": { + "count_dir_skipped": { + "value": 0, + "type": "number" + }, + "count_variables_migrated": { + "value": { + "HelloS3": { + "count_variables_migrated": 4, + "workspaces_ids": [ + "ws-eQcRsTkvor8JMrS9" + ], + "workspaces_url": [ + "https://app.terraform.io/app/tfc-sujay-01/workspaces/hello_s3_default" + ] + } + }, + "type": [ + "object", + { + "HelloS3": [ + "object", + { + "count_variables_migrated": "number", + "workspaces_ids": [ + "tuple", + [ + "string" + ] + ], + "workspaces_url": [ + "tuple", + [ + "string" + ] + ] + } + ] + } + ] + }, + "list_of_new_project_ids": { + "value": [ + "prj-rLU5HSuANryXYhmt" + ], + "type": [ + "tuple", + [ + "string" + ] + ] + }, + "list_of_new_project_names": { + "value": [ + "hello_s3" + ], + "type": [ + "tuple", + [ + "string" + ] + ] + }, + "migration_pr_link": { + "value": [ + "https://github.com/TerraformTestLab/HelloS3/pull/13" + ], + "type": [ + "tuple", + [ + "string" + ] + ] + }, + "workspace_ids": { + "value": { + "HelloS3": { + "count_variables_migrated": 4, + "workspaces_ids": [ + "ws-eQcRsTkvor8JMrS9" + ], + "workspaces_url": [ + "https://app.terraform.io/app/tfc-sujay-01/workspaces/hello_s3_default" + ] + } + }, + "type": [ + "object", + { + "HelloS3": [ + "object", + { + "count_variables_migrated": "number", + "workspaces_ids": [ + "tuple", + [ + "string" + ] + ], + "workspaces_url": [ + "tuple", + [ + "string" + ] + ] + } + ] + } + ] + }, + "workspace_urls": { + "value": { + "HelloS3": { + "count_variables_migrated": 4, + "workspaces_ids": [ + "ws-eQcRsTkvor8JMrS9" + ], + "workspaces_url": [ + "https://app.terraform.io/app/tfc-sujay-01/workspaces/hello_s3_default" + ] + } + }, + "type": [ + "object", + { + "HelloS3": [ + "object", + { + "count_variables_migrated": "number", + "workspaces_ids": [ + "tuple", + [ + "string" + ] + ], + "workspaces_url": [ + "tuple", + [ + "string" + ] + ] + } + ] + } + ] + } + }, + "resources": [ + { + "mode": "managed", + "type": "tfe_project", + "name": "list_of_new_projects", + "provider": "provider[\"registry.terraform.io/hashicorp/tfe\"]", + "instances": [ + { + "index_key": "hello_s3", + "schema_version": 0, + "attributes": { + "description": "Created by Terrafrom Migrate from the Github Repository: TerraformTestLab/HelloS3", + "id": "prj-rLU5HSuANryXYhmt", + "name": "hello_s3", + "organization": "tfc-sujay-01" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "tfmigrate_git_commit_push", + "name": "create_commit", + "provider": "provider[\"registry.terraform.io/hashicorp/tfmigrate\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "branch_name": "hcp-migrate-main", + "commit_hash": "f48539fcc75bb78770eed78ed7043e0d326c573b", + "commit_message": "[skip ci] Migrating local Workspaces from HelloS3 to HCP Terraform", + "directory_path": "/Users/sujaysamanta/Workspace/Codebase/TerraformTestLab/Git-Repos/HelloS3", + "enable_push": true, + "remote_name": "origin", + "summary": "Git Commit with Commit Hash f48539fcc75bb78770eed78ed7043e0d326c573b Completed.and Pushed" + }, + "sensitive_attributes": [], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_variable.variables", + "module.workspace_and_variables.tfe_workspace.workspaces", + "module.workspace_and_variables.tfmigrate_state_migration.state-migration", + "module.workspace_and_variables.tfmigrate_terraform_init.terraform_init", + "module.workspace_and_variables.tfmigrate_update_backend.update-backend", + "tfe_project.list_of_new_projects" + ] + } + ] + }, + { + "mode": "managed", + "type": "tfmigrate_github_pr", + "name": "migration_pr", + "provider": "provider[\"registry.terraform.io/hashicorp/tfmigrate\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "destin_branch": "main", + "pr_body": "This PR is created by TFMigrate CLI to migrate the Workspaces from the repository TerraformTestLab/HelloS3 to the app.terraform.io.", + "pr_title": "HCP Migration of Workspaces in TerraformTestLab/HelloS3 repository", + "pull_request_url": "https://github.com/TerraformTestLab/HelloS3/pull/13", + "repo_identifier": "TerraformTestLab/HelloS3", + "source_branch": "hcp-migrate-main", + "summary": "Git PR Created: https://github.com/TerraformTestLab/HelloS3/pull/13" + }, + "sensitive_attributes": [], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_variable.variables", + "module.workspace_and_variables.tfe_workspace.workspaces", + "module.workspace_and_variables.tfmigrate_state_migration.state-migration", + "module.workspace_and_variables.tfmigrate_terraform_init.terraform_init", + "module.workspace_and_variables.tfmigrate_update_backend.update-backend", + "tfe_project.list_of_new_projects", + "tfmigrate_git_commit_push.create_commit" + ] + } + ] + }, + { + "module": "module.workspace_and_variables[\"HelloS3\"]", + "mode": "data", + "type": "tfe_project", + "name": "project", + "provider": "provider[\"registry.terraform.io/hashicorp/tfe\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "description": "Created by Terrafrom Migrate from the Github Repository: TerraformTestLab/HelloS3", + "id": "prj-rLU5HSuANryXYhmt", + "name": "hello_s3", + "organization": "tfc-sujay-01", + "workspace_ids": [] + }, + "sensitive_attributes": [] + } + ] + }, + { + "module": "module.workspace_and_variables[\"HelloS3\"]", + "mode": "managed", + "type": "tfe_variable", + "name": "variables", + "provider": "provider[\"registry.terraform.io/hashicorp/tfe\"]", + "instances": [ + { + "index_key": "hello_s3_default.bucket_name", + "schema_version": 1, + "attributes": { + "category": "terraform", + "description": "The name of the S3 bucket", + "hcl": false, + "id": "var-Tb775TcSVrkfpZmA", + "key": "bucket_name", + "readable_value": "hellostacksbucket", + "sensitive": false, + "value": "hellostacksbucket", + "variable_set_id": null, + "workspace_id": "ws-eQcRsTkvor8JMrS9" + }, + "sensitive_attributes": [ + [ + { + "type": "get_attr", + "value": "value" + } + ] + ], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "tfe_project.list_of_new_projects" + ] + }, + { + "index_key": "hello_s3_default.enable_encryption", + "schema_version": 1, + "attributes": { + "category": "terraform", + "description": "Enable server-side encryption for the bucket", + "hcl": false, + "id": "var-MtUVqAXEUEoMsJQh", + "key": "enable_encryption", + "readable_value": "true", + "sensitive": false, + "value": "true", + "variable_set_id": null, + "workspace_id": "ws-eQcRsTkvor8JMrS9" + }, + "sensitive_attributes": [ + [ + { + "type": "get_attr", + "value": "value" + } + ] + ], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "tfe_project.list_of_new_projects" + ] + }, + { + "index_key": "hello_s3_default.enable_versioning", + "schema_version": 1, + "attributes": { + "category": "terraform", + "description": "Enable versioning on the S3 bucket", + "hcl": false, + "id": "var-vs3f3xDzXULgQptb", + "key": "enable_versioning", + "readable_value": "true", + "sensitive": false, + "value": "true", + "variable_set_id": null, + "workspace_id": "ws-eQcRsTkvor8JMrS9" + }, + "sensitive_attributes": [ + [ + { + "type": "get_attr", + "value": "value" + } + ] + ], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "tfe_project.list_of_new_projects" + ] + }, + { + "index_key": "hello_s3_default.region", + "schema_version": 1, + "attributes": { + "category": "terraform", + "description": "The AWS region where the bucket will be created", + "hcl": false, + "id": "var-KapLDm96XrG3jCgT", + "key": "region", + "readable_value": "ap-south-1", + "sensitive": false, + "value": "ap-south-1", + "variable_set_id": null, + "workspace_id": "ws-eQcRsTkvor8JMrS9" + }, + "sensitive_attributes": [ + [ + { + "type": "get_attr", + "value": "value" + } + ] + ], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "tfe_project.list_of_new_projects" + ] + } + ] + }, + { + "module": "module.workspace_and_variables[\"HelloS3\"]", + "mode": "managed", + "type": "tfe_workspace", + "name": "workspaces", + "provider": "provider[\"registry.terraform.io/hashicorp/tfe\"]", + "instances": [ + { + "index_key": "default", + "schema_version": 1, + "attributes": { + "agent_pool_id": "", + "allow_destroy_plan": true, + "assessments_enabled": false, + "auto_apply": false, + "auto_apply_run_trigger": false, + "description": "", + "execution_mode": "remote", + "file_triggers_enabled": true, + "force_delete": false, + "global_remote_state": false, + "html_url": "https://app.terraform.io/app/tfc-sujay-01/workspaces/hello_s3_default", + "id": "ws-eQcRsTkvor8JMrS9", + "ignore_additional_tag_names": null, + "name": "hello_s3_default", + "operations": true, + "organization": "tfc-sujay-01", + "project_id": "prj-rLU5HSuANryXYhmt", + "queue_all_runs": false, + "remote_state_consumer_ids": [], + "resource_count": 0, + "source_name": "Tf-Migrate", + "source_url": "https://github.com/hashicorp/tf-migrate", + "speculative_enabled": true, + "ssh_key_id": "", + "structured_run_output_enabled": true, + "tag_names": [ + "hello_s3" + ], + "terraform_version": "1.10.5", + "trigger_patterns": null, + "trigger_prefixes": null, + "vcs_repo": [], + "working_directory": "" + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "tfe_project.list_of_new_projects" + ] + } + ] + }, + { + "module": "module.workspace_and_variables[\"HelloS3\"]", + "mode": "managed", + "type": "tfmigrate_state_migration", + "name": "state-migration", + "provider": "provider[\"registry.terraform.io/hashicorp/tfmigrate\"]", + "instances": [ + { + "index_key": "default", + "schema_version": 0, + "attributes": { + "directory_path": "/Users/sujaysamanta/Workspace/Codebase/TerraformTestLab/Git-Repos/HelloS3", + "local_workspace": "default", + "org": "tfc-sujay-01", + "tfc_workspace": "hello_s3_default" + }, + "sensitive_attributes": [], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "module.workspace_and_variables.tfmigrate_terraform_init.terraform_init", + "tfe_project.list_of_new_projects" + ] + } + ] + }, + { + "module": "module.workspace_and_variables[\"HelloS3\"]", + "mode": "managed", + "type": "tfmigrate_terraform_init", + "name": "terraform_init", + "provider": "provider[\"registry.terraform.io/hashicorp/tfmigrate\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "directory_path": "/Users/sujaysamanta/Workspace/Codebase/TerraformTestLab/Git-Repos/HelloS3", + "summary": "Terraform Init Completed." + }, + "sensitive_attributes": [], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "tfe_project.list_of_new_projects" + ] + } + ] + }, + { + "module": "module.workspace_and_variables[\"HelloS3\"]", + "mode": "managed", + "type": "tfmigrate_update_backend", + "name": "update-backend", + "provider": "provider[\"registry.terraform.io/hashicorp/tfmigrate\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "backend_file_name": "main.tf", + "directory_path": "/Users/sujaysamanta/Workspace/Codebase/TerraformTestLab/Git-Repos/HelloS3", + "org": "tfc-sujay-01", + "project": "hello_s3", + "tags": [ + "hello_s3" + ], + "workspace_map": { + "default": "hello_s3_default" + } + }, + "sensitive_attributes": [], + "dependencies": [ + "module.workspace_and_variables.data.tfe_project.project", + "module.workspace_and_variables.tfe_workspace.workspaces", + "module.workspace_and_variables.tfmigrate_state_migration.state-migration", + "module.workspace_and_variables.tfmigrate_terraform_init.terraform_init", + "tfe_project.list_of_new_projects" + ] + } + ] + } + ], + "check_results": null +} diff --git a/main.tf b/main.tf index 2a298db..9ce5584 100644 --- a/main.tf +++ b/main.tf @@ -7,8 +7,13 @@ terraform { } - backend "local" { - path = "terraform.tfstate" + cloud { + organization = "tfc-sujay-01" + hostname = "app.terraform.io" + workspaces { + project = "hello_s3" + name = "hello_s3_default" + } } } provider "aws" {